You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(storage/import): add support for additional content types and --content-type flag
- Support IANA-registered content types: application/gzip, application/x-xz,
application/x-tar, application/x-bzip2, application/x-7z-compressed,
application/zip, and application/octet-stream
- Add --content-type flag to allow explicit content type specification
- Auto-detect content type from file extension with fallback to octet-stream
- Add getContentType() function for extensible content type mapping
- Add comprehensive unit tests for content type detection
Fixes#581
Copy file name to clipboardExpand all lines: internal/commands/storage/import.go
+33-8Lines changed: 33 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,7 @@ type importCommand struct {
60
60
existingStorageUUIDOrNamestring
61
61
noWait config.OptionalBoolean
62
62
wait config.OptionalBoolean
63
+
contentTypestring
63
64
64
65
createParamscreateParams
65
66
@@ -71,6 +72,7 @@ func (s *importCommand) InitCommand() {
71
72
flagSet:=&pflag.FlagSet{}
72
73
flagSet.StringVar(&s.sourceLocation, "source-location", "", "Location of the source of the import. Can be a file or a URL.")
73
74
flagSet.StringVar(&s.existingStorageUUIDOrName, "storage", "", "Import to an existing storage. Storage must be large enough and must be undetached or the server where the storage is attached must be in shutdown state.")
75
+
flagSet.StringVar(&s.contentType, "content-type", "", "Content type of the file being imported. If not specified, it will be automatically detected based on file extension. Supported types: application/gzip, application/x-xz, application/x-tar, application/x-bzip2, application/x-7z-compressed, application/zip, application/octet-stream")
74
76
config.AddToggleFlag(flagSet, &s.noWait, "no-wait", false, "When importing from remote url, do not wait until the import finishes or storage is in online state. If set, command will exit after import process has been initialized.")
75
77
config.AddToggleFlag(flagSet, &s.wait, "wait", false, "Wait for storage to be in online state before returning.")
0 commit comments