Skip to content
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

Checking whether blob exists or not before generating SAS URI in azure #3291

Merged
merged 1 commit into from
Jun 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion libs/zedUpload/azureutil/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func newSectionWriter(c io.WriterAt, off int64, count int64, part *types.PartDef
}
}

//Write implementation for sectionWriter
// Write implementation for sectionWriter
func (c *sectionWriter) Write(p []byte) (int, error) {
remaining := c.count - c.position

Expand Down Expand Up @@ -460,6 +460,12 @@ func GenerateBlobSasURI(accountURL, accountName, accountKey, containerName, remo
return "", fmt.Errorf("Invalid credentials with error: " + err.Error())
}

// Checking whether blob exists or not before generating SAS URI
_, _, err = GetAzureBlobMetaData(accountURL, accountName, accountKey, containerName, remoteFile, httpClient)
if err != nil {
return "", err
}

// Set the desired SAS signature values and sign them with the shared key credentials to get the SAS query parameters.
sasQueryParams, err := azblob.BlobSASSignatureValues{
Protocol: azblob.SASProtocolHTTPS, // Users MUST use HTTPS (not HTTP)
Expand Down