Skip to content
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

Properly fetch shares for files with spaces/other special characters in filenames #5884

Closed
wants to merge 4 commits into from

Conversation

claucambra
Copy link
Collaborator

Ensure percent encoding is used. PR also includes some other minor fixes

@nextcloud-desktop-bot
Copy link

AppImage file: nextcloud-PR-5884-48f1dfaef5afbce2dba6fcf99e56e5895ae77d1c-x86_64.AppImage

To test this change/fix you can simply download above AppImage file and test it.

Please make sure to quit your existing Nextcloud app and backup your data.

src/gui/filedetails/sharemodel.cpp Outdated Show resolved Hide resolved
src/gui/sharemanager.cpp Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Jul 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

88.9% 88.9% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@allexzander allexzander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claucambra besides one small comment, I've tested and it seems there is some issue with the path:
image

newShare = parseLinkShare(data);
} else if (Share::isShareTypeUserGroupEmailRoomOrRemote(static_cast <Share::ShareType>(shareType))) {
newShare = parseUserGroupShare(data);
shares.append(parseLinkShare(data));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claucambra I don't see a good reason for this refactoring, besides removing space after static_cast you are basically doing the same but introducing more code for review

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while fixing the issue @claucambra would it be possible to write a test for the new method you're adding?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason for this change was to eliminate the likelihood of appending a null newShare to shares, and making the code a little shorter -- it doesn't seem like we need the newShare here.

As for the space I think this was auto-done by clang-format but I can re-add

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into the other points now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claucambra No, I am fine with removing the space. I can see your point about newShare being not null, but there is an else statement so it should never be null, that said, you can just add a check if (newShare) prior to adding it if that makes sense

@claucambra claucambra closed this Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants