-
Notifications
You must be signed in to change notification settings - Fork 0
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
Support image-based R&C for Paper LPAs #200
Conversation
a375a54
to
82daaa9
Compare
- Alter schema to change fields available based on form channel - Add `FileUpload` and `File` struct types - `FileUpload` is used in submissions, `File` is used to pass back - Add `S3Client.UploadFile` to copy base64-encoded files into S3 - On submission of Paper LPAs, store `FileUpload` objects in S3 and return a reference to them in `File` - Update the fixtures UI to support uploads - Fixed some misplaced if/then/else statements in the JSONSchema For CTC-146 #minor
82daaa9
to
eab1525
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be cool to see working 🙌
A couple of Qs
internal/objectstore/client.go
Outdated
} | ||
|
||
hash := sha256.New() | ||
hash.Write(imgData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be handling the (potential) error returned here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I somehow missed that that could return an error. Handled now.
if data.Channel == shared.ChannelPaper && len(input.RestrictionsAndConditionsImages) > 0 { | ||
data.RestrictionsAndConditionsImages = make([]shared.File, len(input.RestrictionsAndConditionsImages)) | ||
for i, image := range input.RestrictionsAndConditionsImages { | ||
path := fmt.Sprintf("%s/scans/rc_%d_%s", data.Uid, i, image.Filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ever likely to get identical filenames?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the inclusion of i
should prevent that, since {uid}/scans/rc_{i}
should itself be a unique identifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, missed that! All good then 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FileUpload
andFile
struct typesFileUpload
is used in submissions,File
is used to pass backS3Client.UploadFile
to copy base64-encoded files into S3FileUpload
objects in S3 and return a reference to them inFile
For CTC-146 #minor