Skip to content

Commit

Permalink
Fix link created by attach method.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoruoruo committed May 31, 2021
1 parent 789c8ae commit 081485a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/com/orgzly/android/ui/share/ShareActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ public Data getDataFromIntent(Intent intent) {
data.bookId = intent.getLongExtra(AppIntent.EXTRA_BOOK_ID, 0L);
}

} else if (ATTACH_METHOD_COPY_DIR.equals(AppPreferences.attachMethod(this))
|| ATTACH_METHOD_COPY_ID.equals(AppPreferences.attachMethod(this))) {
handleCopyFile(intent, data);

} else if (ATTACH_METHOD_COPY_DIR.equals(AppPreferences.attachMethod(this))) {
handleCopyFile(intent, data, "file:");
} else if (ATTACH_METHOD_COPY_ID.equals(AppPreferences.attachMethod(this))) {
handleCopyFile(intent, data, "attachment:");
} else {
// Link method.
handleLinkFile(intent, data);
Expand Down Expand Up @@ -372,7 +372,7 @@ private void handleLinkFile(Intent intent, Data data) {
}
}

private void handleCopyFile(Intent intent, Data data) {
private void handleCopyFile(Intent intent, Data data, String linkPrefix) {
Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);

// Get the file name of the content.
Expand All @@ -383,7 +383,7 @@ private void handleCopyFile(Intent intent, Data data) {
}
if (!OrgStringUtils.isEmpty(fileName)) {
data.title = fileName;
data.content = "attachment:" + fileName;
data.content = "[[" + linkPrefix + fileName + "]]";
} else {
data.title = uri.toString();
data.content = uri.toString() + "\n\nCannot determine fileName to this content.";
Expand Down

0 comments on commit 081485a

Please sign in to comment.