Copying a file and renaming it in the same directory
[to do: add description , test with other mime types]
https://user-images.githubusercontent.com/65948705/157645332-248332e4-9c2b-4799-b134-ffdf4c34acaa.mp4
11:39:44.206 XHRMOVEhttps://staging.eu.collaboraonline.com/nextcloud/remote.php/dav/files/pedro.silva/COOL Weekly/COOLWeekly63 (copy).odt
[HTTP/1.1 500 Internal Server Error 115ms]
MOVE
https://staging.eu.collaboraonline.com/nextcloud/remote.php/dav/files/pedro.silva/COOL%20Weekly/COOLWeekly63%20(copy).odt
Status500
Internal Server Error
VersionHTTP/1.1
Transferred880 B (235 B size)
Referrer Policyno-referrer
Cache-Control
no-store, no-cache, must-revalidate
Connection
close
Content-Length
235
Content-Security-Policy
default-src 'none';
Content-Type
application/xml; charset=utf-8
Date
Thu, 10 Mar 2022 10:39:44 GMT
Expires
Thu, 19 Nov 1981 08:52:00 GMT
Pragma
no-cache
Referrer-Policy
no-referrer
Server
Apache
Strict-Transport-Security
max-age=15768000; includeSubDomains; preload
X-Content-Type-Options
nosniff
X-Download-Options
noopen
X-Frame-Options
SAMEORIGIN
X-Permitted-Cross-Domain-Policies
none
X-Powered-By
PHP/7.4.6
X-Robots-Tag
none
X-XSS-Protection
1; mode=block
Accept
*/*
Accept-Encoding
gzip, deflate, br
Accept-Language
en-GB,en;q=0.5
Cache-Control
no-cache
Connection
keep-alive
Cookie
nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; nc_username=pedro.silva; nc_token=xW2aoDllap3KLIRiXESnUdp20xRAD%2Bbe; nc_session_id=js1rjh98m5fs06mrg6mgs38vsq; oc_sessionPassphrase=Oc%2Bv7F6qBqLs1o7ZHNS6Y3HDM%2F47e%2B2R2Lmwohft4WQ51EtDhg8Vuzqr%2BoPCHFowa0XDcr0OomahYn%2Bc5g9pWzgevPAHMu2TBJCBLe6NC5vYyF3%2BX4S9TXx%2BOFjBhjDW; ocbizrjb36ht=js1rjh98m5fs06mrg6mgs38vsq
Destination
https://staging.eu.collaboraonline.com/nextcloud/remote.php/dav/files/pedro.silva/COOL%20Weekly/COOLWeekly64.odt
Host
staging.eu.collaboraonline.com
Origin
https://staging.eu.collaboraonline.com
Overwrite
F
Pragma
no-cache
requesttoken
VjiGMvB/bYM0q24l1MXOLRviw6oixsHMsvWNZ3uZ3+8=:Y0DDCro0H8Rz2lgV7aaGHEGh8vh2h5a9443CPQjj66o=
Sec-Fetch-Dest
empty
Sec-Fetch-Mode
cors
Sec-Fetch-Site
same-origin
User-Agent
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
X-Requested-With
XMLHttpRequest
HTTP/1.1 500 Internal Server Error
Do you see any error logged in the nextcloud log file about that?
Warning core Controller OC\Core\Controller\PreviewController::getPreviewByFileId executed 3984 queries. 2022-04-28T11:22:12+0200
Fatal webdav OCP\Lock\LockedException: "COOL Weekly/COOLWeekly68 (copy).odt" is locked 2022-04-28T11:22:11+0200
Warning core Controller OC\Core\Controller\PreviewController::getPreviewByFileId executed 3964 queries. 2022-04-28T11:21:41+0200
Warning recommendations Controller OCA\Recommendations\Controller\RecommendationController::index executed 139 queries. 2022-04-28T11:21:29+0200
Warning richdocuments Controller OCA\Richdocuments\Controller\WopiController::putFile executed 158 queries.
[core] Warning: Controller OC\Core\Controller\PreviewController::getPreviewByFileId executed 3984 queries.
GET /nextcloud/index.php/core/preview?fileId=191657&c=4d889ffd00314071fef2e8e0b224a8d7&x=250&y=250&forceIcon=0&a=0
from 185.151.169.3 by pedro.silva at 2022-04-28T09:22:12+00:00
Interesting, looking at the screencast again it looks like it might be related to the file being locked while generating the preview. I still cannot reproduce, but could you maybe check if renaming works fine after waiting for the preview of the new file being loaded?
From the code it could happen that especially if the convert-to endpoint responds slow, a stream is kept open and therefore blocking obtaining the exclusive lock that would be required for the rename. We could just always use a local tmp copy but might have some performance impact on larger files in https://github.com/nextcloud/richdocuments/blob/2e38da75c300d33c42c0a40892656856fbf97983/lib/Preview/Office.php#L75-L80
From the COOL call minutes:
Perhaps good to copy the file to a temp file when generating the preview.
May fail for 600Mb PPTs.
Internally we generate a high-quality pixel preview (Michael)
partly because of hair-line issue → render it large & scale it.
Possibly we could send it with the save → Post two things …
no way to overwrite the preview outside of the preview paths (Julius)