Treat FilePath attribute with leading slash #197

Open
opened 2025-01-23 17:31:52 +00:00 by alexvanin · 0 comments
Owner

We've done some changes for FilePath attribute in #174, let's keep going.
Specification define that FilePath attribute should start with leading slash: link

  // * FilePath \
  //   Full path to be associated with the object on saving. Should start with a
  //   '/' and use '/' as a delimiting symbol. Trailing '/' should be
  //   interpreted as a virtual directory marker. If an object has conflicting
  //   FilePath and FileName, FilePath should have higher priority, because it
  //   is used to construct the directory tree. FilePath with trailing '/' and
  //   non-empty FileName attribute should not be used together.

Describe the solution you'd like

When attribute key is a FilePath, add leading / to the attribute value if it is missing.
During fallback search in #174, do not modify attribute value, thus do not add leading slash.

Describe alternatives you've considered

Do nothing.

Additional context

Right now clients must use double leading slashes to access such FilePath objects, e.g. /path/to/file.jpg is accessed by /get_by_attribute/{cid}/FilePath//path/to/file.jpg query. Some clients merge double slashes into one and it leads to 404 response from gateway.

## Is your feature request related to a problem? Please describe. We've done some changes for FilePath attribute in #174, let's keep going. Specification define that `FilePath` attribute should start with leading slash: [link](https://git.frostfs.info/TrueCloudLab/frostfs-api/src/commit/e33194282c0035bed8fcc652175f5a3dabd902a8/object/types.proto#L146-L147) ```proto // * FilePath \ // Full path to be associated with the object on saving. Should start with a // '/' and use '/' as a delimiting symbol. Trailing '/' should be // interpreted as a virtual directory marker. If an object has conflicting // FilePath and FileName, FilePath should have higher priority, because it // is used to construct the directory tree. FilePath with trailing '/' and // non-empty FileName attribute should not be used together. ``` ## Describe the solution you'd like When attribute key is a `FilePath`, add leading `/` to the attribute value **if it is missing**. During fallback search in #174, **do not** modify attribute value, thus **do not** add leading slash. ## Describe alternatives you've considered Do nothing. ## Additional context Right now clients must use double leading slashes to access such FilePath objects, e.g. `/path/to/file.jpg` is accessed by `/get_by_attribute/{cid}/FilePath//path/to/file.jpg` query. Some clients merge double slashes into one and it leads to 404 response from gateway.
r.loginov was assigned by alexvanin 2025-01-30 07:15:01 +00:00
alexvanin added this to the v0.33.0 milestone 2025-02-11 15:45:13 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-http-gw#197
No description provided.