Merge branch 'main' of https://git.azuze.fr/kawa/Sharepoint-Toolbox
This commit is contained in:
@@ -246,9 +246,6 @@ public class FileTransferService : IFileTransferService
|
||||
var streamResult = srcFile.OpenBinaryStream();
|
||||
await ExecuteQueryRetryHelper.ExecuteQueryRetryAsync(sourceCtx, progress, ct);
|
||||
|
||||
if (streamResult.Value == null)
|
||||
throw new InvalidOperationException($"Could not open binary stream for: {srcFileUrl}");
|
||||
|
||||
using var buffer = new MemoryStream();
|
||||
await streamResult.Value.CopyToAsync(buffer, 81920, ct);
|
||||
buffer.Position = 0;
|
||||
@@ -257,8 +254,6 @@ public class FileTransferService : IFileTransferService
|
||||
// streams the payload in one request and does not touch list-view
|
||||
// metadata, so it bypasses LVT.
|
||||
var slash = effectiveDestUrl.LastIndexOf('/');
|
||||
if (slash < 0)
|
||||
throw new InvalidOperationException($"Invalid destination URL (no slash): {effectiveDestUrl}");
|
||||
var destFolderUrl = effectiveDestUrl.Substring(0, slash);
|
||||
var destFileName = effectiveDestUrl.Substring(slash + 1);
|
||||
|
||||
@@ -278,20 +273,8 @@ public class FileTransferService : IFileTransferService
|
||||
// successful upload to honour Move semantics.
|
||||
var srcDelete = sourceCtx.Web.GetFileByServerRelativeUrl(srcFileUrl);
|
||||
srcDelete.DeleteObject();
|
||||
try
|
||||
{
|
||||
await ExecuteQueryRetryHelper.ExecuteQueryRetryAsync(sourceCtx, progress, ct);
|
||||
}
|
||||
catch (OperationCanceledException) { throw; }
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex,
|
||||
"Move: source delete failed for {Src} after successful upload to {Dst}. " +
|
||||
"File is duplicated — manually delete the source.",
|
||||
srcFileUrl, effectiveDestUrl);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -347,10 +330,8 @@ public class FileTransferService : IFileTransferService
|
||||
await ExecuteQueryRetryHelper.ExecuteQueryRetryAsync(ctx, progress, ct);
|
||||
return file.Exists;
|
||||
}
|
||||
catch (OperationCanceledException) { throw; }
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
Log.Debug("File existence check failed for {Url}: {Error}", fileServerRelativeUrl, ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -457,7 +438,6 @@ public class FileTransferService : IFileTransferService
|
||||
await ExecuteQueryRetryHelper.ExecuteQueryRetryAsync(ctx, progress, ct);
|
||||
return list.ItemCount;
|
||||
}
|
||||
catch (OperationCanceledException) { throw; }
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Non-fatal: pre-flight count is purely informational. Treat as
|
||||
|
||||
Reference in New Issue
Block a user