Merge pull request #1254 from owncloud/droid-update
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / CreateShareViaLinkOperation.java
index 1449094..373c57d 100644 (file)
@@ -44,8 +44,6 @@ import com.owncloud.android.operations.common.SyncOperation;
 
 public class CreateShareViaLinkOperation extends SyncOperation {
 
-    private static final int READ_ONLY = 1;
-
     protected FileDataStorageManager mStorageManager;
 
     private String mPath;
@@ -87,7 +85,7 @@ public class CreateShareViaLinkOperation extends SyncOperation {
                     "",
                     false,
                     mPassword,
-                    READ_ONLY
+                    OCShare.DEFAULT_PERMISSION
             );
             result = operation.execute(client);
         }
@@ -116,7 +114,8 @@ public class CreateShareViaLinkOperation extends SyncOperation {
 
     public Intent getSendIntentWithSubject(Context context) {
         if (context != null && mSendIntent != null && mSendIntent.getStringExtra(Intent.EXTRA_SUBJECT) != null) {
-            if (getClient() == null || getClient().getCredentials().getUsername() == null) {
+            if (getClient() == null || getClient().getCredentials() == null ||
+                    getClient().getCredentials().getUsername() == null) {
                 mSendIntent.putExtra(
                         Intent.EXTRA_SUBJECT,
                         context.getString(R.string.subject_shared_with_you, mFileName)
@@ -143,8 +142,7 @@ public class CreateShareViaLinkOperation extends SyncOperation {
         } else {
             share.setIsFolder(false);
         }
-        share.setPermissions(READ_ONLY);
-        
+
         getStorageManager().saveShare(share);
         
         // Update OCFile with data from share: ShareByLink  and publicLink