@@ -5038,6 +5038,59 @@ addEventListener('fetch', event => {});`
5038
5038
` ) ;
5039
5039
} ) ;
5040
5040
5041
+ it ( "should attach an 'application/null' content-type header when uploading files with an unknown extension" , async ( ) => {
5042
+ const assets = [ { filePath : "foobar.greg" , content : "something-binary" } ] ;
5043
+ writeAssets ( assets ) ;
5044
+ writeWranglerConfig ( {
5045
+ assets : { directory : "assets" } ,
5046
+ } ) ;
5047
+
5048
+ const manifestBodies : AssetManifest [ ] = [ ] ;
5049
+ const mockBuckets = [ [ "80e40c1f2422528cb2fba3f9389ce315" ] ] ;
5050
+ await mockAUSRequest ( manifestBodies , mockBuckets , "<<aus-token>>" ) ;
5051
+ const uploadBodies : FormData [ ] = [ ] ;
5052
+ const uploadAuthHeaders : ( string | null ) [ ] = [ ] ;
5053
+ const uploadContentTypeHeaders : ( string | null ) [ ] = [ ] ;
5054
+ await mockAssetUploadRequest (
5055
+ mockBuckets . length ,
5056
+ uploadBodies ,
5057
+ uploadAuthHeaders ,
5058
+ uploadContentTypeHeaders
5059
+ ) ;
5060
+ mockSubDomainRequest ( ) ;
5061
+ mockUploadWorkerRequest ( {
5062
+ expectedAssets : {
5063
+ jwt : "<<aus-completion-token>>" ,
5064
+ config : { } ,
5065
+ } ,
5066
+ expectedType : "none" ,
5067
+ } ) ;
5068
+ await runWrangler ( "deploy" ) ;
5069
+ expect ( manifestBodies . length ) . toBe ( 1 ) ;
5070
+ expect ( manifestBodies [ 0 ] ) . toEqual ( {
5071
+ manifest : {
5072
+ "/foobar.greg" : {
5073
+ hash : "80e40c1f2422528cb2fba3f9389ce315" ,
5074
+ size : 16 ,
5075
+ } ,
5076
+ } ,
5077
+ } ) ;
5078
+ const flatBodies = Object . fromEntries (
5079
+ uploadBodies . flatMap ( ( b ) => [ ...b . entries ( ) ] )
5080
+ ) ;
5081
+ await expect (
5082
+ flatBodies [ "80e40c1f2422528cb2fba3f9389ce315" ]
5083
+ ) . toBeAFileWhichMatches (
5084
+ new File (
5085
+ [ "c29tZXRoaW5nLWJpbmFyeQ==" ] ,
5086
+ "80e40c1f2422528cb2fba3f9389ce315" ,
5087
+ {
5088
+ type : "application/null" ,
5089
+ }
5090
+ )
5091
+ ) ;
5092
+ } ) ;
5093
+
5041
5094
it ( "should be able to upload files with special characters in filepaths" , async ( ) => {
5042
5095
// NB windows will disallow these characters in file paths anyway < > : " / \ | ? *
5043
5096
const assets = [
0 commit comments