diff --git a/cmd/tusd/cli/flags.go b/cmd/tusd/cli/flags.go index 296928f..35aaeec 100644 --- a/cmd/tusd/cli/flags.go +++ b/cmd/tusd/cli/flags.go @@ -74,7 +74,7 @@ func ParseFlags() { flag.BoolVar(&Flags.S3DisableContentHashes, "s3-disable-content-hashes", false, "Disable the calculation of MD5 and SHA256 hashes for the content that gets uploaded to S3 for minimized CPU usage (experimental and may be removed in the future)") flag.BoolVar(&Flags.S3DisableSSL, "s3-disable-ssl", false, "Disable SSL and only use HTTP for communication with S3 (experimental and may be removed in the future)") flag.StringVar(&Flags.GCSBucket, "gcs-bucket", "", "Use Google Cloud Storage with this bucket as storage backend (requires the GCS_SERVICE_ACCOUNT_FILE environment variable to be set)") - flag.StringVar(&Flags.GCSObjectPrefix, "gcs-object-prefix", "", "Prefix for GCS object names (can't contain underscore character)") + flag.StringVar(&Flags.GCSObjectPrefix, "gcs-object-prefix", "", "Prefix for GCS object names") flag.StringVar(&Flags.AzStorage, "azure-storage", "", "Use Azure BlockBlob Storage with this container name as a storage backend (requires the AZURE_ACCOUNT_NAME and AZURE_ACCOUNT_KEY environment variable to be set)") flag.StringVar(&Flags.AzContainerAccessType, "azure-container-access-type", "", "Access type when creating a new container if it does not exist (possible values: blob, container, '')") flag.StringVar(&Flags.AzBlobAccessTier, "azure-blob-access-tier", "", "Blob access tier when uploading new files (possible values: archive, cool, hot, '')") diff --git a/pkg/gcsstore/gcsservice.go b/pkg/gcsstore/gcsservice.go index 4667622..3acbcbd 100644 --- a/pkg/gcsstore/gcsservice.go +++ b/pkg/gcsstore/gcsservice.go @@ -351,7 +351,11 @@ loop: if strings.HasSuffix(objAttrs.Name, "info") { continue } - split := strings.Split(objAttrs.Name, "_") + + fileNameParts := strings.Split(objAttrs.Name, "/") + fileName := fileNameParts[len(fileNameParts)-1] + + split := strings.Split(fileName, "_") // If the object name does not split on "_", we have a composed object. // If the object name splits on "_" in to four pieces we diff --git a/pkg/gcsstore/gcsservice_test.go b/pkg/gcsstore/gcsservice_test.go index eeffe15..2c91430 100644 --- a/pkg/gcsstore/gcsservice_test.go +++ b/pkg/gcsstore/gcsservice_test.go @@ -447,7 +447,7 @@ func TestFilterObject(t *testing.T) { defer gock.Off() resp := googleBucketResponse{[]googleObjectResponse{ - googleObjectResponse{Name: "test-prefix_1"}, + googleObjectResponse{Name: "test_directory/test-prefix_1"}, }} gock.New("https://www.googleapis.com").