On Fri, 27 May 2022 19:09:05 GMT, Brian Burkhalter <[email protected]> wrote:
>> Modify `sun.net.www.MimeTable.findByFileName(String)` to attempt to find the
>> file extension in the entire file name if it is not found in the portion of
>> the name preceding the optional fragment beginning with a hash (`#`).
>
> Brian Burkhalter has updated the pull request incrementally with one
> additional commit since the last revision:
>
> 8287237: Refactor and clean up
src/java.base/share/classes/sun/net/www/MimeTable.java line 188:
> 186: int hashIndex = fname.lastIndexOf(HASH_MARK);
> 187: if (hashIndex > 0) {
> 188: String ext = getFileExtension(fname.substring(0, hashIndex -
> 1));
Hello Brian, I think there's a bug here. Not introduced by this PR but even in
the current master. I think that `fname.substring(0, hashIndex -1)` call should
actually be `fname.substring(0, hashIndex)`. For example, in its current form,
if `fname` is `a.png#foo` then `fname.substring(...)` here will return `a.pn`
instead of `a.png`. It looks like we don't have a test for that case.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8909