New issue
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
Feature suggestion: auto content-type on blob creation #47
Comments
I assume you mean that we would try to detect the file type and automatically set the Content-type metadata for the blob. On the client side, we don't do this for developers because there are several different ways to accomplish in Java (extension, magic bytes) this with pros/cons for each method. We don't want to dictate how or whether to automatically detect the mime type so it's left to developers to do. You can do a quick Google search for "java file mime type" for several methods of detecting the mime type. If you'd like to file a feature request against the actual backend API, you can file an issue against the service: https://issuetracker.google.com/issues/new?component=187243&template=0 |
@chingor13 , is there any update on this feature request? |
@chingor13 thoughts on providing a It would be completely optional and shouldn't breaking any existing code. |
@chingor13 , @dhoard public final String getContentType() {
if (headerProvider != null) {
for (Map.Entry<String, String> entry : headerProvider.getHeaders().entrySet()) {
if ("content-type".equals(entry.getKey().toLowerCase())) {
return entry.getValue();
}
}
}
return null;
} |
@andrey-qlogic conceptually that might work. From an implementation standpoint, it would be better to perform a
@chingor13 your feedback? |
Similar fix in nodejs: googleapis/nodejs-storage#1190 |
What if the API saves the blob setting it's content-type automatically? I guess it would make sense at least for public blobs. Do you have an opinion on that?
Cheers
The text was updated successfully, but these errors were encountered: