yandrey321 opened a new pull request, #12147:
URL: https://github.com/apache/ozone/pull/12147

   ## What changes were proposed in this pull request?
   
   **Problem**
   
   In FSO buckets, S3 Gateway exposes every directory, including implicit 
parents, as a `dir/` object (HDDS-7922).
   HEAD and GET on it return 200 with `Content-Type: binary/octet-stream`, 
length 0 and no ETag, so it looks like an
   empty file. Clients that recognize directories by the 
`application/x-directory` marker, such as Flink's Presto-based
   S3 filesystem (`s3p://`), therefore treat these directories as files. 
Restoring a Flink savepoint stored in an FSO
   bucket fails with `NoSuchKey`.
   
   **Implementation idea**
   
   `ObjectEndpoint.contentTypeOf()` now returns `application/x-directory` when 
the key is not a file
   (`!key.isFile()`). HEAD and GET both get their Content-Type from this 
helper, so both responses change.
   
   **Key decisions**
   
   - The directory check uses `OzoneKey.isFile()`, the same signal 
`EndpointBase.validateFileKey` already uses.
     The OM sets it to false only for FSO directories and forces it to true for 
every OBS and legacy key.
   - A directory always reports `application/x-directory`, even if Content-Type 
metadata is stored on it. This gives
     clients one consistent signal, including for implicit parent directories 
that have no metadata.
   - The `response-content-type` query parameter still overrides the value on 
GET, as for any other object.
   - There is no config flag. S3A doesn't use Content-Type to detect 
directories and writes this marker itself, so it is
     unaffected.
   
   **Side effects**
   
   - HEAD and GET on FSO directory keys return a different Content-Type. Files, 
OBS and legacy buckets are unchanged.
   - Listings are unchanged, because ListObjects responses carry no 
Content-Type.
   - No protocol or OM change. The `isFile` flag arrived with the `getKeyInfo` 
OM call that S3G uses (HDDS-7419), so
     every OM that answers that call sets it.
   
   Co-authored-by: Claude Opus 5.5 <[email protected]>
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17893
   
   ## How was this patch tested?
   
   Unit + integration tests.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to