-
Notifications
You must be signed in to change notification settings - Fork 122
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
Handle tiffs correctly #3050
Handle tiffs correctly #3050
Conversation
val mimeType: MimeType | ||
val meta: Map[String, String] | ||
} | ||
case class StorableThumbImage(id: String, file: File, mimeType: MimeType, meta: Map[String, String] = Map.empty) extends StorableImage |
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.
We've refactored here to codify the three possible sorts of images in types. In this way, it's harder to make an error by mistaking one StorableImage
for another.
common-lib/src/main/scala/com/gu/mediaservice/lib/ImageIngestOperations.scala
Show resolved
Hide resolved
) | ||
|
||
case class ImageUploadOpsDependencies( | ||
config: ImageUploadOpsCfg, |
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.
minor: So much whitespace! Can we be consistent here? There's a setting in IntelliJ to control this, if only I could remember which it is...
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.
Not one for this PR, but it would be great to add Scalafmt or similar to the project.
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.
Some helpful comments I hope. LMK if you want to run through IRL.
common-lib/src/main/scala/com/gu/mediaservice/lib/ImageIngestOperations.scala
Outdated
Show resolved
Hide resolved
common-lib/src/main/scala/com/gu/mediaservice/lib/ImageIngestOperations.scala
Outdated
Show resolved
Hide resolved
common-lib/src/main/scala/com/gu/mediaservice/lib/ImageIngestOperations.scala
Outdated
Show resolved
Hide resolved
common-lib/src/main/scala/com/gu/mediaservice/lib/imaging/ImageOperations.scala
Outdated
Show resolved
Hide resolved
common-lib/src/main/scala/com/gu/mediaservice/lib/ImageIngestOperations.scala
Outdated
Show resolved
Hide resolved
Seen on kahuna, metadata-editor (merged by @aug24 16 minutes and 3 seconds ago) Please check your changes! |
Seen on collections, auth, image-loader-projection (merged by @aug24 16 minutes and 8 seconds ago) Please check your changes! |
Seen on image-loader (merged by @aug24 16 minutes and 17 seconds ago) Please check your changes! |
What does this change?
Existing code does not handle tiffs correctly.
In an attempt to extract an optimised file for use in the UI, an error meant that the optimised file was uploaded in place of the original.
This PR completely rewrites the upload process in idiomatic futures which makes the process clearer.
Specifically, instead of nested flatmaps across futures, the process now uses a for comprehension to complete the futures. Futures which can be parallelised are created outside the for comp, those which are necessarily sequential (ie depend on prior results) are created inside.
This PR also adds tests, which unfortunately do not run in CI, pending a docker or similar environment with imagemagic/graphicsmagic.
How can success be measured?
Tiff files (and any other kind of file) should
Screenshots (if applicable)
Who should look at this?
Tested?