File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Shared.IntegrationTests/UploadApi
Shared/Actions/AssetsUpload Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -975,6 +975,24 @@ public void TestEvalUploadParameter()
975975 Assert . IsInstanceOf < double > ( uploadResult . QualityAnalysis . Focus ) ;
976976 }
977977
978+ [ Test , RetryWithDelay ]
979+ public void TestUploadFilenameOverride ( )
980+ {
981+ const string filenameOverride = "test_overridden" ;
982+
983+ var uploadParams = new ImageUploadParams ( )
984+ {
985+ File = new FileDescription ( m_testImagePath ) ,
986+ Tags = m_apiTag ,
987+ FilenameOverride = filenameOverride
988+ } ;
989+
990+ var uploadResult = m_cloudinary . Upload ( uploadParams ) ;
991+
992+ Assert . IsNotNull ( uploadResult ) ;
993+ Assert . AreEqual ( filenameOverride , uploadResult . OriginalFilename ) ;
994+ }
995+
978996 //[Test, RetryWithDelay]
979997 //public void TestTextAlign()
980998 //{
Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ public virtual ResourceType ResourceType
3737 get { return Actions . ResourceType . Raw ; }
3838 }
3939
40+ /// <summary>
41+ /// Gets or sets file name to override an original file name.
42+ /// </summary>
43+ public string FilenameOverride { get ; set ; }
44+
4045 /// <summary>
4146 /// Validate object model.
4247 /// </summary>
@@ -64,10 +69,11 @@ public override void Check()
6469 /// <returns>Sorted dictionary of parameters.</returns>
6570 public override SortedDictionary < string , object > ToParamsDictionary ( )
6671 {
67- SortedDictionary < string , object > dict = base . ToParamsDictionary ( ) ;
72+ var dict = base . ToParamsDictionary ( ) ;
6873
6974 AddParam ( dict , "public_id" , PublicId ) ;
7075 AddParam ( dict , "type" , Type ) ;
76+ AddParam ( dict , "filename_override" , FilenameOverride ) ;
7177
7278 if ( Backup . HasValue )
7379 {
You can’t perform that action at this time.
0 commit comments