Duy Huynh created OAK-12570:
-------------------------------
Summary: Content-Disposition filename fallback contains NUL for
supplementary characters
Key: OAK-12570
URL: https://issues.apache.org/jira/browse/OAK-12570
Project: Jackrabbit Oak
Issue Type: Bug
Components: blob-plugins
Affects Versions: 1.38.0, 1.22.6
Reporter: Duy Huynh
DataRecordDownloadOptions.formatContentDispositionHeader builds the
filename="..." fallback with
new String(ISO_8859_1.encode(fileName).array(), ISO_8859_1).
For file names containing supplementary characters (surrogate pairs, e.g.
U+267CC or emoji), the encoded ByteBuffer is shorter than its backing array, so
the unused zero bytes end up in the header as NUL characters. The resulting
signed direct-download URI is rejected by the blob store.
Introduced by OAK-9304.
Proposed fix: use new String(fileName.getBytes(ISO_8859_1), ISO_8859_1)
instead. Each unmappable code point becomes a single '?'; filename* is
unchanged.
PR: https://github.com/apache/jackrabbit-oak/pull/3330
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)