You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "japplis (via GitHub)" <gi...@apache.org> on 2024/05/28 21:29:05 UTC

[PR] Fix for incorrect detection of %2f as separator at a few places in UriParser [commons-vfs]

japplis opened a new pull request, #542:
URL: https://github.com/apache/commons-vfs/pull/542

   The detection of %2f in `UriParser.readNonSeparator()` is incorrect as it always compare a String of length 2 with a String of length 3.
   
   After the fix, a unit test failed:
   `NamingTests` -> `assertSameName(path, name, "foo%2f..%2fa", scope);`
   The reason was before the fix the resolved path was '/Java/libraries/commons-vfs/commons-vfs2/target/test-classes/test-data/read-tests/foo%2f..%2fa'
   After the fix the resolved path is '/Java/libraries/commons-vfs/commons-vfs2/target/test-classes/test-data/read-tests%2fa'
   `AbstractFileName.checkName` (with scope child) wasn't failing first as `path.charAt(baseLen)` was '/' (the '/' before foo)
   then it was failing as the separator at baseLen was %2f and not '/'.
   So I've changed the `UriParser.PathNormalizer.readSeparator()` to also normalize the '%2f' to '/'. This fixes the unit tests.
   
   While adding more unit tests, I also noticed the different handling of '/' and %2f in `UriParser.normalisePath()` and fixed it.
   
   I don't know why it shows a big diff when I only changed a few lines in `UriParser`. I guess it may have to do with the line feed but I've read many post on internet and tried many things for 1 hour without any result. If it's a problem let me know, I'll do a clean clone again and recreate the change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix for incorrect detection of %2f as separator at a few places in UriParser [commons-vfs]

Posted by "japplis (via GitHub)" <gi...@apache.org>.
japplis commented on PR #542:
URL: https://github.com/apache/commons-vfs/pull/542#issuecomment-2136817973

   I'm closing with pull request as I had problems to fix the line feed in the diff in this branch. I've created a new branch with a new pull request with the same change (and fix for the large diff): https://github.com/apache/commons-vfs/pull/543
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix for incorrect detection of %2f as separator at a few places in UriParser [commons-vfs]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #542:
URL: https://github.com/apache/commons-vfs/pull/542#issuecomment-2136381887

   Hello @japplis 
   You'll need to update the PR to only show what's actually changed (IOW not the whole file).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix for incorrect detection of %2f as separator at a few places in UriParser [commons-vfs]

Posted by "japplis (via GitHub)" <gi...@apache.org>.
japplis closed pull request #542: Fix for incorrect detection of %2f as separator at a few places in UriParser
URL: https://github.com/apache/commons-vfs/pull/542


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org