return;
}
+ var latestState = action.FileState;
+
//Do not upload files in conflict
- if (action.FileState.FileStatus == FileStatus.Conflict)
+ if (latestState.FileStatus == FileStatus.Conflict)
{
Log.InfoFormat("Skipping file in conflict [{0}]", fileInfo.FullName);
return;
}
//Do not upload files when we have no permission
- if (action.FileState.FileStatus == FileStatus.Forbidden)
+ if (latestState.FileStatus == FileStatus.Forbidden)
{
Log.InfoFormat("Skipping forbidden file [{0}]", fileInfo.FullName);
return;
var cloudInfo = client.GetObjectInfo(account, cloudFile.Container, cloudFile.Name);
//If this is a read-only file, do not upload changes
- if (cloudInfo.AllowedTo == "read")
+ if (!cloudInfo.IsWritable(action.AccountInfo.UserName))
return;
if (fileInfo is DirectoryInfo)
await UploadWithHashMap(accountInfo, cloudFile, fileInfo as FileInfo, cloudFile.Name, treeHash);
}
//If everything succeeds, change the file and overlay status to normal
- StatusKeeper.SetFileState(fullFileName, FileStatus.Unchanged, FileOverlayStatus.Normal);
+ StatusKeeper.SetFileState(fullFileName, FileStatus.Unchanged, FileOverlayStatus.Normal, "");
}
catch (WebException exc)
{
throw;
if (response.StatusCode == HttpStatusCode.Forbidden)
{
- StatusKeeper.SetFileState(fileInfo.FullName, FileStatus.Forbidden, FileOverlayStatus.Conflict);
+ StatusKeeper.SetFileState(fileInfo.FullName, FileStatus.Forbidden, FileOverlayStatus.Conflict, "Forbidden");
+
}
-
- //In any other case, propagate the error
- throw;
+ else
+ //In any other case, propagate the error
+ throw;
}
}
//Notify the Shell to update the overlays
{
Log.Error("Not allowed to upload file", exc);
var message = String.Format("Not allowed to uplad file {0}", action.LocalFile.FullName);
- StatusKeeper.SetFileState(action.LocalFile.FullName, FileStatus.Unchanged, FileOverlayStatus.Normal);
+ StatusKeeper.SetFileState(action.LocalFile.FullName, FileStatus.Unchanged, FileOverlayStatus.Normal, "");
StatusNotification.NotifyChange(message, TraceLevel.Warning);
return true;
}