diff --git a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs
index 1d0a0a0702b7..22c7402b7bed 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyValueEditor.cs
@@ -189,8 +189,7 @@ private bool IsAllowedInDataTypeConfiguration(string extension, object? dataType
}
// get the filepath
- // in case we are using the old path scheme, try to re-use numbers (bah...)
- var filepath = _mediaFileManager.GetMediaPath(file.FileName, contentKey, propertyTypeKey); // fs-relative path
+ string filepath = GetMediaPath(file, dataTypeConfiguration, contentKey, propertyTypeKey);
using (Stream filestream = file.OpenReadStream())
{
@@ -201,9 +200,19 @@ private bool IsAllowedInDataTypeConfiguration(string extension, object? dataType
// TODO: Here it would make sense to do the auto-fill properties stuff but the API doesn't allow us to do that right
// since we'd need to be able to return values for other properties from these methods
- _mediaFileManager.FileSystem.AddFile(filepath, filestream, true); // must overwrite!
+ _mediaFileManager.FileSystem.AddFile(filepath, filestream, overrideIfExists: true); // must overwrite!
}
return filepath;
}
+
+ ///
+ /// Provides media path.
+ ///
+ /// File system relative path
+ protected virtual string GetMediaPath(TemporaryFileModel file, object? dataTypeConfiguration, Guid contentKey, Guid propertyTypeKey)
+ {
+ // in case we are using the old path scheme, try to re-use numbers (bah...)
+ return _mediaFileManager.GetMediaPath(file.FileName, contentKey, propertyTypeKey);
+ }
}
diff --git a/src/Umbraco.Infrastructure/PropertyEditors/TemporaryFileUploadValidator.cs b/src/Umbraco.Infrastructure/PropertyEditors/TemporaryFileUploadValidator.cs
index 71aba644cd95..e927c2fcb4cf 100644
--- a/src/Umbraco.Infrastructure/PropertyEditors/TemporaryFileUploadValidator.cs
+++ b/src/Umbraco.Infrastructure/PropertyEditors/TemporaryFileUploadValidator.cs
@@ -1,4 +1,4 @@
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models.TemporaryFile;
using Umbraco.Cms.Core.Models.Validation;
@@ -6,20 +6,20 @@
namespace Umbraco.Cms.Core.PropertyEditors;
-internal class TemporaryFileUploadValidator : IValueValidator
+public class TemporaryFileUploadValidator : IValueValidator
{
private readonly GetContentSettings _getContentSettings;
private readonly ParseTemporaryFileKey _parseTemporaryFileKey;
private readonly GetTemporaryFileModel _getTemporaryFileModel;
private readonly ValidateFileType? _validateFileType;
- internal delegate ContentSettings GetContentSettings();
+ public delegate ContentSettings GetContentSettings();
- internal delegate Guid? ParseTemporaryFileKey(object? editorValue);
+ public delegate Guid? ParseTemporaryFileKey(object? editorValue);
- internal delegate TemporaryFileModel? GetTemporaryFileModel(Guid temporaryFileKey);
+ public delegate TemporaryFileModel? GetTemporaryFileModel(Guid temporaryFileKey);
- internal delegate bool ValidateFileType(string extension, object? dataTypeConfiguration);
+ public delegate bool ValidateFileType(string extension, object? dataTypeConfiguration);
public TemporaryFileUploadValidator(
GetContentSettings getContentSettings,