summaryrefslogtreecommitdiff
path: root/annotations/generate_annotated_java_files.py
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2019-11-21 15:43:53 +0000
committerTobias Thierer <tobiast@google.com>2019-11-22 14:44:56 +0000
commit08e4eb248b39f7b0430290e0998c3251877bd564 (patch)
tree764d6e4425a543cbe48bb87d7d59f64dc10a5a19 /annotations/generate_annotated_java_files.py
parent895e529ade28d30227ff9bb0f095ff216b487e66 (diff)
DefaultFileNameMap: Support extensions that contain '.'.
Android 10 added many new MIME mappings, with one extension (pcf.Z) containing a '.'. URLConnection.getFileNameMap() treated the part of the filename after the last '.' as the extension, so it only checked 'Z' and didn't recognize 'pcf.Z'. This CL fixes this by letting DefaultFileNameMap pick the longest filename suffix that follows a '.' and is a known extension. This means that after this CL, URLConnection.getFileNameMap().getContentTypeFor("fileName.pcf.Z") will now return "application/x-font-pcf" because it looks up "pcf.Z" before attempting "Z". Previously, it would have returned null because the logic would only have considered "Z", which is not a known extension. For backwards compatibility with historic versions of Android, if filename contains no '.' then the whole filename is also considered as an extension, but only if the filename didn't contain a path component ('/'). The details of this historic behavior seem somewhat accidental and may be changed in a future CL, but that is orthogonal to this change. Bug: 141880067 Test: atest CtsLibcoreTestCases:libcore.java.net.URLConnectionTest Change-Id: I3da4ec4491a8eef74e8874d1a5c43fcfa523c3f8
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions