@@ -58,7 +58,7 @@ import type { SupportedCollectionType, UploadCollectionConfig } from "@/composab
5858import type { NewUploadItem } from "@/composables/upload/uploadItemTypes" ;
5959import { getAppRoot } from "@/onload/loadConfig" ;
6060import { errorMessageAsString } from "@/utils/simple-error" ;
61- import { isUrl } from "@/utils/url" ;
61+ import { isUrl , isValidUrl } from "@/utils/url" ;
6262
6363import { createTusUpload , type FileStream , type NamedBlob , type UploadableFile } from "./tusUpload" ;
6464
@@ -127,6 +127,8 @@ interface UploadItemCommon {
127127 deferred : boolean ;
128128 /** Optional hash values for verification */
129129 hashes ?: FetchDatasetHash [ ] ;
130+ /** Whether to auto-decompress the upload */
131+ auto_decompress : boolean ;
130132}
131133
132134/** Upload item from a local file */
@@ -349,6 +351,7 @@ export function createFileUploadItem(
349351 to_posix_lines : options . to_posix_lines ?? uploadItemDefaults . to_posix_lines ,
350352 deferred : options . deferred ?? uploadItemDefaults . deferred ,
351353 hashes : options . hashes ,
354+ auto_decompress : true ,
352355 } ;
353356}
354357
@@ -385,6 +388,7 @@ export function createPastedUploadItem(
385388 to_posix_lines : options . to_posix_lines ?? uploadItemDefaults . to_posix_lines ,
386389 deferred : options . deferred ?? uploadItemDefaults . deferred ,
387390 hashes : options . hashes ,
391+ auto_decompress : true ,
388392 } ;
389393}
390394
@@ -410,12 +414,13 @@ export function createUrlUploadItem(
410414 historyId : string ,
411415 options : Partial < Omit < UrlUploadItem , "src" | "url" | "historyId" > > = { } ,
412416) : UrlUploadItem {
417+ const trimmedUrl = url . trim ( ) ;
413418 // Extract filename from URL if not provided
414- const defaultName = url . split ( "/" ) . pop ( ) ?. split ( "?" ) [ 0 ] || DEFAULT_FILE_NAME ;
419+ const defaultName = trimmedUrl . split ( "/" ) . pop ( ) ?. split ( "?" ) [ 0 ] || DEFAULT_FILE_NAME ;
415420
416421 return {
417422 src : "url" ,
418- url,
423+ url : trimmedUrl ,
419424 historyId,
420425 name : options . name ?? defaultName ,
421426 size : options . size ?? 0 ,
@@ -425,6 +430,7 @@ export function createUrlUploadItem(
425430 to_posix_lines : options . to_posix_lines ?? uploadItemDefaults . to_posix_lines ,
426431 deferred : options . deferred ?? uploadItemDefaults . deferred ,
427432 hashes : options . hashes ,
433+ auto_decompress : true ,
428434 } ;
429435}
430436
@@ -449,6 +455,7 @@ export function toApiUploadItem(item: NewUploadItem): ApiUploadItem {
449455 to_posix_lines : item . toPosixLines ,
450456 deferred : item . deferred ,
451457 hashes : item . hashes ,
458+ auto_decompress : true ,
452459 } ;
453460
454461 switch ( item . uploadMode ) {
@@ -510,7 +517,7 @@ export function parseContentToUploadItems(
510517 // If first line is a URL, treat all lines as URLs
511518 if ( isUrl ( firstLine ) ) {
512519 return lines . filter ( Boolean ) . map ( ( urlLine ) => {
513- if ( ! isUrl ( urlLine ) ) {
520+ if ( ! isValidUrl ( urlLine ) ) {
514521 throw new Error ( `Invalid URL: ${ urlLine } ` ) ;
515522 }
516523 return createUrlUploadItem ( urlLine , historyId , options ) ;
@@ -536,7 +543,7 @@ function buildDataElement(item: ApiUploadItem): ApiDataElement {
536543 name : normalizeFileName ( item . name ) ,
537544 space_to_tab : item . space_to_tab ,
538545 to_posix_lines : item . to_posix_lines ,
539- auto_decompress : false ,
546+ auto_decompress : true ,
540547 deferred : item . deferred ,
541548 } ;
542549
@@ -598,7 +605,7 @@ function validateItemContent(item: ApiUploadItem): void {
598605 if ( ! item . url || item . url . trim ( ) . length === 0 ) {
599606 throw new Error ( `No URL for upload item: ${ item . name } ` ) ;
600607 }
601- if ( ! isUrl ( item . url ) ) {
608+ if ( ! isValidUrl ( item . url ) ) {
602609 throw new Error ( `Invalid URL: ${ item . url } ` ) ;
603610 }
604611 break ;
@@ -674,7 +681,7 @@ export function buildUploadPayload(items: ApiUploadItem[], options: BuildPayload
674681 history_id : historyId ,
675682 targets : [
676683 {
677- auto_decompress : false ,
684+ auto_decompress : true ,
678685 destination : { type : "hdas" } ,
679686 elements,
680687 } ,
0 commit comments