0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AndroidでUTF-8-MACなファイル名をS3からCognito経由でダウンロードするとAccess Deniedになる問題

Last updated at Posted at 2017-10-30

概要

UTF-8-MACなファイル(いわゆるOSXで濁点とかがついているファイル)をS3にアップロードして、Cognito経由でダウンロードしようとするとAccess Deniedとなる問題

Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied

↓OSXで作ったこういうファイル
image.png

↓実際のソースにコピペするとこんな感じ
image.png

結論

  • aws-android-sdk-s3のバージョンを2.3.+にする(2.4.+以上だと起きる)
  • 最新版2.6.6でも起きる(2017/10/30現在)
build.gradle
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    // AWS
    // 2.3.+系では動く
    compile 'com.amazonaws:aws-android-sdk-core:2.3.+'
    compile 'com.amazonaws:aws-android-sdk-s3:2.3.+'
    // 2.4.+系以上では動かない
    //compile 'com.amazonaws:aws-android-sdk-core:2.4.+'
    //compile 'com.amazonaws:aws-android-sdk-s3:2.4.+'
}

補足

一応issue立てたのでそのうち治るかもしれないですが、現状はバージョンを下げて対応しています。
ちなみにiOS版では起きないです。AndroidのSDKのバグです。

(そもそもそんな名前のファイルあげるなよって意見もあるかもですが)

参考にした記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?