google / java-photoslibrary

Java client library for the Google Photos Library API
http://developers.google.com/photos
Apache License 2.0
107 stars 64 forks source link

No support for non-ASCII filenames #7

Closed hoangdangduy closed 2 years ago

hoangdangduy commented 5 years ago

My video file has name "xin chào các bạn.MP4". I set file name and description also are text "xin chào các bạn" but when I see information video on web interface it is error font. If I upload direct from browser it still show name right.

Check on web interface qa google photo client java 1

Code I use to set file name and description of video. Also use variable fileName qa google photo client java 2

Is it the library's fault? Please check!

jfschmakeit commented 5 years ago

Thanks for filing this issue!

Unfortunately the upload endpoint does not currently support non-ASCII filenames. (That's a limitation on the Google Photos Library API, not just this client library.) This is definitely something we would like to address. We don't have a timeframe for this yet, but I'll update this issue as soon as I have any updates.

jfschmakeit commented 2 years ago

Apologies for not closing this earlier, but this issue was actually addressed a few releases ago.

Filenames should now be specified as part of the call to batchCreateMediaItems(..). You should specify the filename as part of the NewMediaItem, which supports unicode. Also refer to the upload media guide for more details.

Here's an example:

 NewMediaItem newMediaItem = NewMediaItemFactory
          .createNewMediaItem(uploadToken, fileName, itemDescription);
  List<NewMediaItem> newItems = Arrays.asList(newMediaItem);

  BatchCreateMediaItemsResponse response = photosLibraryClient.batchCreateMediaItems(newItems);