V10: AllowedUploadFiles appsetting not working (#13408)
* Add new Settings * Use new settings instead of old ones * Implement AllowedUploadedFiles value to be copied to AllowedUplayedFileExtensions * Obsolete old settings * Rename DisallowedUploadFileExtensions * Implement same fix for DisallowedUploadFiles * Use new settings for backoffice server variables * Update the correct setting Co-authored-by: Zeegaan <nge@umbraco.dk>
This commit is contained in:
@@ -10,9 +10,9 @@ public static class ContentSettingsExtensions
|
||||
/// Allow upload if extension is whitelisted OR if there is no whitelist and extension is NOT blacklisted.
|
||||
/// </summary>
|
||||
public static bool IsFileAllowedForUpload(this ContentSettings contentSettings, string extension) =>
|
||||
contentSettings.AllowedUploadFiles.Any(x => x.InvariantEquals(extension)) ||
|
||||
(contentSettings.AllowedUploadFiles.Any() == false &&
|
||||
contentSettings.DisallowedUploadFiles.Any(x => x.InvariantEquals(extension)) == false);
|
||||
contentSettings.AllowedUploadedFileExtensions.Any(x => x.InvariantEquals(extension)) ||
|
||||
(contentSettings.AllowedUploadedFileExtensions.Any() == false &&
|
||||
contentSettings.DisallowedUploadedFileExtensions.Any(x => x.InvariantEquals(extension)) == false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the auto-fill configuration for a specified property alias.
|
||||
|
||||
@@ -196,11 +196,13 @@ public class ContentSettings
|
||||
/// Gets or sets a value for the collection of file extensions that are disallowed for upload.
|
||||
/// </summary>
|
||||
[DefaultValue(StaticDisallowedUploadFiles)]
|
||||
[Obsolete("Please use DisAllowedUploadedFileExtensions instead, scheduled for removal in V13")]
|
||||
public IEnumerable<string> DisallowedUploadFiles { get; set; } = StaticDisallowedUploadFiles.Split(',');
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value for the collection of file extensions that are allowed for upload.
|
||||
/// </summary>
|
||||
[Obsolete("Please use AllowedUploadedFileExtensions instead, scheduled for removal in V13")]
|
||||
public IEnumerable<string> AllowedUploadFiles { get; set; } = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
@@ -249,4 +251,15 @@ public class ContentSettings
|
||||
/// </summary>
|
||||
[DefaultValue(StaticAllowEditInvariantFromNonDefault)]
|
||||
public bool AllowEditInvariantFromNonDefault { get; set; } = StaticAllowEditInvariantFromNonDefault;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value for the collection of file extensions that are allowed for upload.
|
||||
/// </summary>
|
||||
public string[] AllowedUploadedFileExtensions { get; set; } = Array.Empty<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value for the collection of file extensions that are disallowed for upload.
|
||||
/// </summary>
|
||||
[DefaultValue(StaticDisallowedUploadFiles)]
|
||||
public string[] DisallowedUploadedFileExtensions { get; set; } = StaticDisallowedUploadFiles.Split(',');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user