dropbox / dropbox/stone

ReadPath regex in files.stone does not match U+2028 in filename

Open
#309 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
413
Forks
81
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
https://github.com/dropbox/dropbox-sdk-java/issues/490
This issue was reported in the dropbox java sdk.

**To Reproduce**
Attempt to call `getMetadata` with a filename that has U+2028 in it. It will fail to match the regex and throw java.lang.IllegalArgumentException: String 'path' does not match pattern.

If you attempt to escape the Unicode character, the server returns a malformed path error.

**Expected Behavior**
Files with a valid path would match the regex and return the file metadata.

**Actual Behavior**
java.lang.IllegalArgumentException: String 'path' does not match pattern.
or
Malformed path error from the server

**Versions**
* What version of the Stone are you using? Latest stone, latest api spec from Sep 1, 2022
* What version of the language are you using? Java
* What platform are you using? (if applicable) Dropbox Java Sdk

**Additional context**
I think the fix is as simple as changing the regex to
`(/(.|[\r\n\u2028])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?)`
in files.stone but would like somebody with more stone experience to chime in.

Contributor guide

Open the contributing guide

Research direction

Start in files.stone at the ReadPath regex and reproduce the getMetadata case with a filename containing U+2028. Compare the regex behavior with the proposed change, then verify that valid paths match without triggering the malformed path error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.