Dnn.Platform icon indicating copy to clipboard operation
Dnn.Platform copied to clipboard

Non-Integer Thumbnail Sizes Break API Calls

Open v-karbovnichy opened this issue 3 years ago • 1 comments
trafficstars

Description of bug

Non-Integer Thumbnail Sizes Break API Calls

Steps to reproduce

  1. Try zooming out several times in your browser.
  2. Reload a DNN Page with the Assets page of the Persona Bar open.
  3. If the thumbnails fail to load, look in the network tab for the failing calls.

It is easy to reproduce the failed API calls with non-integer parameters: make an API call to http://{your dnn install}.dnndev.me/DnnImageHandler.ashx?mode=securefile&fileId={a file id}&MaxWidth=74.98&MaxHeight=42.01

Current behavior

API calls return with HTTP 500

Expected behavior

API parses the non-integer parameters and returns thumbnail based on rounded dimensions

Screenshots

See here https://docs.google.com/document/d/1DgWvWwNloNGleA7zpt6sqb4fT_W1V9gSwzmZhRBWKBg/edit

Error information

n/a

Additional context

n/a

Affected version

  • [x] 10.00.00 alpha build
  • [x] 09.11.00 release candidate
  • [x] 09.10.02 release candidate
  • [x] 09.10.01 latest supported release

Affected browser

  • [x] Chrome
  • [ ] Firefox
  • [ ] Safari
  • [ ] Internet Explorer 11
  • [ ] Microsoft Edge (Classic)
  • [ ] Microsoft Edge Chromium

v-karbovnichy avatar Sep 12 '22 15:09 v-karbovnichy

I will submit a PR

v-karbovnichy avatar Sep 12 '22 15:09 v-karbovnichy

I am pretty sure this commit introduces a new url requirement for the profilepic mode. If you do not include the maxHeight or maxWidth (which I don't think is currently happening by default) the DefaultDimension of 10px becomes the maxHeight and maxWidth. This makes some renderings blurry and defaults others to small sizes. It could impact themes and modules that use the ImageHandler as well upon the next upgrade.

If there are no additional concerns regarding the maxHeight and maxWidth params then it may be less disruptive to bypass the DefaultDimension implementations for requests made for profilepic mode.

Here is a branch I can submit as a PR that tries to fix this or it may just be referenced on the way to something more robust.

https://github.com/DNNMonster/Dnn.Platform/commit/c74e9eb57254599cdf156b0f47f3a86828dac7ff

DNNMonster avatar Dec 25 '22 06:12 DNNMonster

@DNNMonster I agree this is a breaking change, can you submit that as a pull request

valadas avatar Jan 05 '23 19:01 valadas