Skip to content

Commit

Permalink
Small refactoring and doc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaptoss committed Jul 22, 2024
1 parent 2141a54 commit efb8acc
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/spec/components/schemas/UploadImageResponse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ allOf:
properties:
url:
type: string
description: Pre-Signed URL for upload the file
description: Pre-signed URL to upload the file
example: https://bucket.nyc3.digitaloceanspaces.com/somefile?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=DO00PTJRCBZELX6E4EEK%2F20240722%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240722T133921Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=940c9058b90e8836b03470fdb51af1f24baabc16a7a83b80352d3d618aa4f23f
2 changes: 1 addition & 1 deletion docs/spec/components/schemas/UploadImageResponseKey.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ required:
properties:
id:
type: string
description: UUID for check form submission status
description: UUID to check form submission status
type:
type: string
enum: [ upload_image_response ]
2 changes: 1 addition & 1 deletion docs/spec/paths/integrations@forms-svc@[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ post:
- User form
summary: Generate pre-signed url
description: |
Generate Pre-Signed URL for the provided content-length
Generate pre-signed URL for the provided content-length
and content-type, with a configurable lifetime.
The response contains a URL with a signature and
other information that should be used to upload image
Expand Down
2 changes: 1 addition & 1 deletion internal/service/handlers/upload_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func UploadImage(w http.ResponseWriter, r *http.Request) {
}
}

signedURL, key, err := Storage(r).GeneratePUTURL(req.Data.Attributes.ContentType, req.Data.Attributes.ContentLength)
signedURL, key, err := Storage(r).GeneratePutURL(req.Data.Attributes.ContentType, req.Data.Attributes.ContentLength)
if err != nil {
Log(r).WithError(err).Error("Failed to generate pre-signed url")
ape.RenderErr(w, problems.InternalError())
Expand Down
2 changes: 1 addition & 1 deletion internal/storage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (s *Storage) ValidateImage(object *url.URL) error {
return nil
}

func (s *Storage) GeneratePUTURL(contentType string, contentLength int64) (signedURL, key string, err error) {
func (s *Storage) GeneratePutURL(contentType string, contentLength int64) (signedURL, key string, err error) {
key = uuid.New().String()
req, _ := s.client.PutObjectRequest(&s3.PutObjectInput{
Bucket: &s.bucket,
Expand Down

0 comments on commit efb8acc

Please sign in to comment.