瀏覽代碼

safeguard: if the file hasn't stored the link yet, retrieve it from server first

AndyScherzinger 6 年之前
父節點
當前提交
83340e84c3
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java

+ 6 - 1
src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java

@@ -34,6 +34,7 @@ import android.support.v7.widget.AppCompatCheckBox;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.support.v7.widget.SearchView;
+import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
@@ -259,7 +260,11 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
     @OnClick({R.id.share_link_label, R.id.share_link_copy_icon})
     public void copyLinkToClipboard() {
         if (file.isSharedViaLink()) {
-            ClipboardUtil.copyToClipboard(getActivity(), file.getPublicLink());
+            if (TextUtils.isEmpty(file.getPublicLink())) {
+                showSendLinkTo();
+            } else {
+                ClipboardUtil.copyToClipboard(getActivity(), file.getPublicLink());
+            }
         }
     }