Always show fullsize imgur images#209
Conversation
Tunous
left a comment
There was a problem hiding this comment.
Did you check whether there are tests in UrlParser, and if it would be possible to add new tests for your changes?
It’s not a requirement but would be nice to have.
| // Strip any preview-related suffixes and queries | ||
| imageUrl = imageUrl.newBuilder() | ||
| .encodedQuery(null) | ||
| .encodedPath(imgurPreviewPat.matcher(imageUrlPath).replaceFirst(".")) |
There was a problem hiding this comment.
It probably won’t occur but what if that pattern was found earlier than before extension? Maybe it’s better to replace last occurrence instead.
There was a problem hiding this comment.
Using java's matcher this can only be done by a more precise regex. Something like s/_d(\.\w+)$/$1/
|
yes, I'll add test cases for this |
b5e382d to
46cfbb6
Compare
|
that should do it |
|
Great, thanks. |
|
By the way, maybe it worth to add |
|
Sounds like a good idea for improvement. |
When submission contains direct imgur url sometimes Dawn were loading preview images.
_dfilename suffix and .webp extension both required to reproduce this. I've added webp as image format and also added stripping of_djust to be safe