-
Notifications
You must be signed in to change notification settings - Fork 698
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
fix: media upload to have applicationName as User-Agent #2227
Conversation
LGTM -- Changes make sense. I do that the Lines 453 to 463 in 0d1e5db
AbstractGoogleClient . I think this is searchable on CloudRAD, but is hidden away in the Builder: https://cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.services.AbstractGoogleClient.Builder#com_google_api_client_googleapis_services_AbstractGoogleClient_Builder_setApplicationName_java_lang_String_
Do you think it would make sense to have this documented a bit more visible? |
Yeah, I think it's fine as it is. Personally, I would have assumed setting the user-agent would be something like I do see there are guides here: https://googleapis.github.io/google-api-java-client/media-upload.html. Maybe a quick blurb/ section/ example on this page about how applicationName is the user-agent that is passed in the headers -- or if you think it's already clear enough I'm fine with as well. |
String applicationName = abstractGoogleClient.getApplicationName(); | ||
HttpRequestInitializer requestInitializer = | ||
mediaUploadRequestUserAgentInitializer(applicationName, requestFactory.getInitializer()); | ||
this.uploader = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenWhitehead Would you review this fix? The pull request description has how I confirmed it with regard to the internal bug b/252963877. |
Fixes #2222
How I confirmed the fix:
I locally installed this branch via
mvn install
and specified the SNAPSHOT version of the BOM:I ran @BenWhitehead 's reproducer (with my small modification):
Note that userAgent is used in only
setApplicationName(userAgent)
.I placed src/main/resources/logging.properties so that it prints debug (FINE-level) log:
This is specified via
-Djava.util.logging.config.file=src/main/resources/logging.properties
argument in IntelliJ.It printed out the expected User-Agent when uploading the data: