WPAndroid: copying media files from private sites does not work
mzorz opened this issue · 1 comments
mzorz commented
Originally reported by @thehenrybyrd, @mattmiklic (p5T066-2hM#comment-8396
, p5T066-2hM#comment-8408
)
When trying to add a media item to a Story block from the site's media on a private site, access to it is forbidden and produces the following exception, leading to no media items being added:
(Note: replaced sitename with<sitename>
down here)
76 - [May-24 13:11 UTILS] https://<sitename>.files.wordpress.com/2016/05/img_1603.jpg
77 - [May-24 13:11 UTILS] StackTrace: java.io.FileNotFoundException: https://<sitename>.files.wordpress.com/2016/05/img_1603.jpg
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:255)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:211)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:30)
at java.net.URL.openStream(URL.java:1072)
at org.wordpress.android.util.MediaUtils.downloadExternalMedia(MediaUtils.java:225)
at org.wordpress.android.util.MediaUtilsWrapper.copyFileToAppStorage(MediaUtilsWrapper.kt:41)
at org.wordpress.android.ui.posts.editor.media.CopyMediaToAppStorageUseCase.copyToAppStorage(CopyMediaToAppStorageUseCase.kt:51)
at org.wordpress.android.ui.posts.editor.media.CopyMediaToAppStorageUseCase.access$copyToAppStorage(CopyMediaToAppStorageUseCase.kt:15)
at org.wordpress.android.ui.posts.editor.media.CopyMediaToAppStorageUseCase$copyFilesToAppStorageIfNecessary$2.invokeSuspend(CopyMediaToAppStorageUseCase.kt:34)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Steps to reproduce:
- I closed the WordPress app and restarted it
- selected an existing draft post with a blank Story block in it,
- and then continued as normal: tapped “add media” and then the wordpress icon, selected a few files, and saw the upload dialog briefly and was dropped back into media selector instead of story creation.
thehenrybyrd commented
Once we've got a fix, we should make sure to test picking media both from Media Library and from Pexels, as both were effected on private sites.