OC-5.0.4 renamed file sharing failed
Upload a file (eg 1.png). Sharing with link works, but don't share it for now.
Rename it: 1.png -> 2.png
Trying to share with link: "Sharing 26 failed, because the sharing backend for file could not find its source"
From syslog messages: Apr 11 12:51:41 pilv ownCloud[1256]: {OCP\Share} Sharing 26 failed, because the sharing backend for file could not find its source
From filesystem perspective file is renamed (2.png).
'oc_filecache' table also contains new filename: path: files/2.png name: 2.png
And now the trick: delete the file. Go to "Deleted files" and restore. Now sharing with link works again.
@schiesbn @blizzz @icewind1991 @MTGap
May it be related to the rename hook issue? cc @butonic
Related to #2795, #2840 ? :)
Trying to reproduce this. Some clarifications:
- Upload a file (eg 1.png).
- Rename it: 1.png -> 2.png
- sharing via link without a page refresh give the error mentioned by @PisikeSipelgas: "Sharing 26 failed, because the sharing backend for file could not find its source"
- try scanFiles(true) in the browser console (warning will rescan all files, might take a while. better use a test account), on completion, sharing still fails with the same error
- reload page: sharing via link works
Looking at the db the fileid is no longer present in the db. Further investigation reveals that a file rename also changes the fileid ?!?!? @icewind1991 is this intended? So either we have to update the browser and tell him the new file id, or there is something wrong with file renames.
digging deeper ...
Duplicate of #2170
Come on guys I've described the problem multiple times on the mailing list and in the issue above. @butonic this is exactly what our emails about renaming files is trying to resolve.
It seems that OC\Files\Cache\Cache->move($source, $target) is called too late.
$sourceId = $this->getId($source); returns -1
@MTGap yeah but this one I can actually reproduce ;)
All the details are already in my 2 initial emails.