diff --git a/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftHelper.kt b/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftHelper.kt index 5328fef70..5038ac00c 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftHelper.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/drafts/DraftHelper.kt @@ -59,13 +59,19 @@ class DraftHelper @Inject constructor( ): Completable { return Single.fromCallable { - val draftDirectory = context.getExternalFilesDir("Tusky") + val externalFilesDir = context.getExternalFilesDir("Tusky") - if (draftDirectory == null || !(draftDirectory.exists())) { + if (externalFilesDir == null || !(externalFilesDir.exists())) { Log.e("DraftHelper", "Error obtaining directory to save media.") throw Exception() } + val draftDirectory = File(externalFilesDir, "Drafts") + + if (!draftDirectory.exists()) { + draftDirectory.mkdir() + } + val uris = mediaUris.map { uriString -> uriString.toUri() }.map { uri ->