We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public static MediaType getFileMediaType(String fileName) { String extension = getUrlExtension(fileName); if (!MimeTypeMap.getSingleton().hasExtension(extension)) { if (TextUtils.equals("json", extension)) { return MediaType.APPLICATION_JSON; } return MediaType.APPLICATION_OCTET_STREAM; } String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); try { return MediaType.parseMediaType(mimeType); } catch (Exception e) { return MediaType.APPLICATION_OCTET_STREAM; } }
这个方法中的MimeTypeMap.getSingleton().hasExtension(extension)当extension为json是在android9以下设备上返回的是false,在android9以上设备上返回的是true,导致android9一下设备对于.json文件返回的contentType不对,正常应当返回application/json,实际返回了application/octet-stream
The text was updated successfully, but these errors were encountered:
No branches or pull requests
这个方法中的MimeTypeMap.getSingleton().hasExtension(extension)当extension为json是在android9以下设备上返回的是false,在android9以上设备上返回的是true,导致android9一下设备对于.json文件返回的contentType不对,正常应当返回application/json,实际返回了application/octet-stream
The text was updated successfully, but these errors were encountered: