Comments (5)
Thanks for reporting. I would not expect the Nextcloud storage layers to truncated the file when the storage throws an out of quota exception but I might be wrong there. I'll check that on our side.
For the error, we can definitely report back such a case on the WOPI request. It actually would be good to know the size upfront to we do not even attempt to write larger files if they don't fit.
- Check if Content-Length is already passed by Collabora and if we can validate it against the free space
- Check why
Regarding reporting back we might need to agree on a response status and format to give back a custom error message as WOPI itself only defines some basic status codes and no format for a response body https://learn.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/putfile#status-codes However I think error message hand over to also show something to the user would be nice in any failure case
from richdocuments.
We can check for the quota with something like this:
Server storage layer does not check the quota upfront as is just does a stream copy without being aware of the size.
diff --git a/lib/Controller/WopiController.php b/lib/Controller/WopiController.php
index a9cf99ac..5e31e318 100644
--- a/lib/Controller/WopiController.php
+++ b/lib/Controller/WopiController.php
@@ -70,6 +70,7 @@ use OCP\Share\IShare;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Log\LoggerInterface;
+use Sabre\DAV\Exception\InsufficientStorage;
class WopiController extends Controller {
/** @var IRootFolder */
@@ -107,6 +108,7 @@ class WopiController extends Controller {
// Signifies LOOL that document has been changed externally in this storage
public const LOOL_STATUS_DOC_CHANGED = 1010;
+ public const LOOL_STATUS_NO_SPACE = 3000;
public const WOPI_AVATAR_SIZE = 64;
@@ -506,6 +508,13 @@ class WopiController extends Controller {
}
}
+ $size = $this->request->getHeader('Content-Length');
+
+ if ($file->getParent()->getFreeSpace() < $size) {
+ return new JSONResponse([
+ 'LOOLStatusCode' => self::LOOL_STATUS_NO_SPACE,
+ ]);
+ }
$content = fopen('php://input', 'rb');
try {
from richdocuments.
@thebearon What do you think about adding a new status code for this in https://github.com/CollaboraOnline/online/blob/db31a486dfbf42669662b2b2d8db74bf99f881a0/wsd/Storage.hpp#L311 ?
We could actually extend this even further with a custom error message that Nextcloud could return, e.g. to indicate more clearly what to check in other error cases like of https://learn.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/putfile#status-codes
from richdocuments.
@pedropintosilva Something we probably can discuss next week in our call, I think having a way to report the proper root cause back to the user within Collabora Online would be really benificial here to not just show a generic error if the save has failed.
from richdocuments.
Filed CollaboraOnline/online#8713 upstream for improved error reporting
from richdocuments.
Related Issues (20)
- Fail to edit files, having a 500 http error and "Failed to generate token for file" error message HOT 5
- cURL error 28: Connection timed out after 120001 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://github.com/nextcloud-releases/richdocuments/releases/download/v8.4.2/richdocument-v8.4.2.tar.gz HOT 2
- Popup "Check security warnings of your server" cannot be discarded HOT 1
- Moving in excel sheet on android cause resseting view, also sheet is choppy HOT 1
- Richdocuments feedback tab on android phone is out of display HOT 2
- [Bug]: Fatal Error using Collabora CODE/Nextcloud Office unable to edit documents in browser with Nextcloud 29.0.2.2 HOT 1
- Clipboard copy paste not working properly HOT 7
- unable to upload fonts to managed instance HOT 5
- Update to v8.4.3 broke Nextcloud, had to disable richdocuments app HOT 8
- Unit defaults to inch (does not respect language settings) HOT 1
- [Bug]: OC\\Http\\Client\\Client::get(): Argument #1 ($uri) must be of type string, null given HOT 6
- Problems with font selection. Is this normal? HOT 1
- Unable to Rename Version While Editing File HOT 1
- Collabora resets file changes at server restart HOT 2
- The extra fonts "Make sure to set this URL" instructions should not be shown when built-in CODE is selected
- Display a warning in the Extra fonts settings when HTTP in-use that Extra fonts won't work w/o HTTPS
- Office widget in talk: user added every time the chat is opened HOT 2
- Files sometimes do not get opened immediately on internal links HOT 7
- Watermarking can break previews in text documents
- disable_certificate_verification no longer works HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from richdocuments.