-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override third party libraries to check for filename casing #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks fine.
@SergioBertolinSG can you test if that works correctly with all operations ? I think we used to have unit tests that you can run against your own account, but need to be run manually.
Added some comments in code |
OK now it is keeping the filenames coming from dropbox backend, good. But files/folder uploaded to OC are still being lowercased. (It requires some refreshes to see it). |
I have removed that code which was converting paths to lowercase |
No idea why this is happening |
Yes, this behaviour happens always, the conflict shows some random info when uploading the same file with different cases. To reproduce:
Result: @PVince81 what should be the right behaviour here? no conflict at all? Uploading directly? (it is the same file after all). |
Renaming to a different case returns a warning:
Steps to reproduce:
And it leads to duplicated files. The old filename only existing in owncloud, not in dropbox. |
@SergioBertolinSG how do other case insensitive storages behave like SMB ? if they have the same issue then please ignore until we sort out these scenarios. cc @jvillafanez |
Regarding SMB, uploading "FilE.txt" stores the file in SMB with the same case, and returns the file with the same case. The problem is that for SMB "FilE.txt" is the same that "file.txt" and "File.txt", so when if you have uploaded "FilE.txt" and check if "file.txt" exists, SMB says that the file exists. Storing the file is case-sensitive but the filename comparison is case-insensitive. I think this sums up more or less what's happening with SMB. |
@Hemant-Mann the behaviour should be the same as in SMB. |
Yes @SergioBertolinSG The same is the case for Dropbox
|
This #28 (comment) and #28 (comment) Should be addressed to merge this. |
@PVince81 Could you give a hint as to where should I look in code to address @SergioBertolinSG #28 (comment) ? |
I don't know sorry, would need to step with a debugger. |
@Hemant-Mann can you step there with a debugger ? |
Yeah will do |
Okay so I understood a few things
Now I try to upload this file ContacTs.json I get error from server
===> Response Body
So I put a breakpoint in frontend JS as well Inside that function we try to find more info about the conflicting file here So the function getFullPath is returning |
Also found 2 more things
|
@PVince81 any ideas on how to fix the different file name issue in oc_filecache? This is where data is fetched for ContacTs.json https://github.com/owncloud/core/blob/master/lib/private/Files/Cache/Scanner.php#L149 so Checked in Debugger |
Correction this PR does not introduce this bug
Behaviour is the same with master branch I checked From what I have seen in the code, I guess this should be a problem for all case insensitive storage Consider the
|
As long as the behaviour is acceptable and ownCloud doesn't do weird things, I'd just return whatever Dropbox is doing. If you have contacts.json and Dropbox says that contacTs.json exists, then just go with it. As far as I know, there are only a couple of problematic behaviours: uploading a file with the same name but different casing and renaming a file with different casing. If ownCloud just rejects both operations, I think it's fine as long as the users know this. |
Yes this is the current behaviour But a new file contacTs.json is added in |
So should we merge this? |
maybe we need a more generic solution in general when dealing with any kind of case insensitive storages: owncloud/core#17161. From @jvillafanez's research this is not easy to achieve. If this PR makes Dropbox works a little better then let's merge it as a step forward. |
* This property is used to check whether the storage is case insensitive or not | ||
* @var boolean | ||
*/ | ||
protected $isCaseInsensitiveStorage = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs vs. spaces -> please unify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay let me correct this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@patrickjahns I checked in the editor it is indented using Tabs only
the diff is because previously this block was indented using tab size: 2 whereas the whole file was indented using tab size: 4
Moved to development and adjusted base branch |
Merge this? |
@SergioBertolinSG |
#27 is fixed here but Which is a different behaviour than WND. |
@SergioBertolinSG
You can verify with master branch the behaviour is the same. Both of your comments can be reproduced easily a) Regarding the incorrect conflict dialog box it related to b) Regarding duplicate file issue #28 (comment) it is also related to ownCloud core @PVince81 have mentioned here #28 (comment) (This behaviour should be easily reproduced with other case insensitive storages) |
@Hemant-Mann Ok I have check those using current master and you are right. So lets merge this and open separated issues about them. |
@SergioBertolinSG |
Opened here: Renaming of files to a different case leads to file duplication. #33 Files conflict dialog is not prepared to deal with case-sensitive storages. |
Fix for #27
I have modified the
League\Util\ContentListingFormatter
class which checks whether the file is a part of the current directory or not.The checks are done based on the property
OCA\Files_external_dropbox\Storage::isCaseInsensitiveStorage