Browse Source

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

AndyScherzinger 6 years ago
parent
commit
83340e84c3

+ 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());
+            }
         }
     }