From dc0edf3feeb17489da285f8a8e91ad5c66b9b833 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 30 Aug 2021 17:47:13 +0000 Subject: [PATCH] --- source/Plugins/AyaNova.Plugin.V8/V8.cs | 32 +++++++++++++++++++++++- source/Plugins/AyaNova.Plugin.V8/util.cs | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index babad38..6c681c9 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -5507,6 +5507,13 @@ namespace AyaNova.PlugIn.V8 progress.SubOp("Wikifile: \"" + af.Name + "\" " + AyaBizUtils.FileSizeDisplay((decimal)af.FileSize)); if (IsDuplicatev7v8IdMapItem(i.LT_O_AyaFile.Value, i.LT_O_AyaFile.Display, progress)) continue; + + if (af.FileSize > SmallestFileUploadRejectedAsTooBig) + { + progress.Append("WIKI Attachment file " + i.LT_O_AyaFile.Display + " too large (" + af.FileSize.ToString() + ") for this server. Adjust destination server settings to allow"); + continue; + } + //Compile the FileData property var sDate = i.LT_Common_Label_Created.ToString(); DateTimeOffset dtLastModified = DateTime.UtcNow; @@ -5563,7 +5570,30 @@ namespace AyaNova.PlugIn.V8 formDataContent.Add(AttachmentFile); //Upload - var a = await util.PostFormDataAsync("attachment", formDataContent); + util.ApiResponse a = null; + + try + { + a=await util.PostFormDataAsync("attachment", formDataContent); + } + catch (Exception ex) + { + if (ex.Message.Contains("413")) + { + if (SmallestFileUploadRejectedAsTooBig > af.FileSize) + SmallestFileUploadRejectedAsTooBig = af.FileSize; + progress.Append("WIKI Attachment file " + i.LT_O_AyaFile.Display + " too large (" + af.FileSize.ToString() + ") for this server. Adjust destination server settings to allow"); + continue; + + } + else + { + throw; + } + } + + + //Map it for later processing of wiki //attachment upload route returns all attachments for this object in file name order //so need to find *our* most recent uploaded attachment so need to find the highest raven id number diff --git a/source/Plugins/AyaNova.Plugin.V8/util.cs b/source/Plugins/AyaNova.Plugin.V8/util.cs index 409861d..8e044cb 100644 --- a/source/Plugins/AyaNova.Plugin.V8/util.cs +++ b/source/Plugins/AyaNova.Plugin.V8/util.cs @@ -359,6 +359,8 @@ namespace AyaNova.PlugIn.V8 } catch (Exception ex) { + if (ex.Message.Contains("413")) throw;//too large, no point in retrying at all let upstream caller handle it immediately + if (FirstException == null) FirstException = ex; }