Skip to content

Add ContentDisposition and ContentType to blob.GetSASURLOptions #22024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

yp05327
Copy link

@yp05327 yp05327 commented Nov 21, 2023

  • Add ContentDisposition and ContentType to blob.GetSASURLOptions
    In old version, users can set Content-Disposition header in GetSASURLOptions for customizing the filename.

    type BlobProperties struct {
    LastModified TimeRFC1123 `xml:"Last-Modified"`
    Etag string `xml:"Etag"`
    ContentMD5 string `xml:"Content-MD5" header:"x-ms-blob-content-md5"`
    ContentLength int64 `xml:"Content-Length"`
    ContentType string `xml:"Content-Type" header:"x-ms-blob-content-type"`
    ContentEncoding string `xml:"Content-Encoding" header:"x-ms-blob-content-encoding"`
    CacheControl string `xml:"Cache-Control" header:"x-ms-blob-cache-control"`
    ContentLanguage string `xml:"Cache-Language" header:"x-ms-blob-content-language"`
    ContentDisposition string `xml:"Content-Disposition" header:"x-ms-blob-content-disposition"`
    BlobType BlobType `xml:"BlobType"`
    SequenceNumber int64 `xml:"x-ms-blob-sequence-number"`
    CopyID string `xml:"CopyId"`
    CopyStatus string `xml:"CopyStatus"`
    CopySource string `xml:"CopySource"`
    CopyProgress string `xml:"CopyProgress"`
    CopyCompletionTime TimeRFC1123 `xml:"CopyCompletionTime"`
    CopyStatusDescription string `xml:"CopyStatusDescription"`
    LeaseStatus string `xml:"LeaseStatus"`
    LeaseState string `xml:"LeaseState"`
    LeaseDuration string `xml:"LeaseDuration"`
    ServerEncrypted bool `xml:"ServerEncrypted"`
    IncrementalCopy bool `xml:"IncrementalCopy"`
    }

    But this is not supported in the latest version now.

  • About the test
    In Adding nil check for GetSASURLOptions.format() #19945, all tests for GetSASURLOptions were removed.
    I added a test for blob.GetSASURLOptions, maybe this is unnecessary? If it is unnecessary, I will remove it.

  • The purpose of this PR is explained in this or a referenced issue.

  • The PR does not update generated files.

    • These files are managed by the codegen framework at [Azure/autorest.go][].
  • Tests are included and/or updated for code changes.

  • Updates to module CHANGELOG.md are included.

  • MIT license headers are included in each file.

@github-actions github-actions bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage Storage Service (Queues, Blobs, Files) labels Nov 21, 2023
Copy link

Thank you for your contribution @yp05327! We will review the pull request and get back to you soon.

@yp05327
Copy link
Author

yp05327 commented Nov 21, 2023

@microsoft-github-policy-service agree

@yp05327
Copy link
Author

yp05327 commented Nov 21, 2023

@souravgupta-msft
Copy link
Member

@yp05327, thanks for creating this PR. I want to mention that the blob.GetSASURL() method is for general use case. There are several other fields in BlobSignatureValues other than ContentDisposition and ContentType, that are not exposed in the blob.GetSASURLOptions.

You can refer this code for creating blob SAS using these fields.

@yp05327
Copy link
Author

yp05327 commented Nov 22, 2023

@souravgupta-msft, thanks for your comment. Do you mean that if users want to set values of fields in BlobSignatureValues other than StartTime and ExpiryTime, they need to implement a similar GetSASURL function by themselves?
And are there any reasons that not all fields in BlobSignatureValues can be exposed as GetSASURLOptions?

@vibhansa-msft
Copy link
Member

GetSASURL is a generic method built for most common use cases. If an expert user wishes to create a very specific request, it can be created by directly created using other methods that exposes all available options (which is internally used by GetSASUrL itself). Just exposing 2 options out of a bunch is not good.

@yp05327
Copy link
Author

yp05327 commented Nov 23, 2023

Ok, I will close this PR.

@yp05327 yp05327 closed this Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants