Skip to content
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

feat: Add route that sets projectRestrictedViewSetting size (DEV-2304) #2794

Merged
merged 55 commits into from
Sep 29, 2023

Conversation

mpro7
Copy link
Contributor

@mpro7 mpro7 commented Aug 15, 2023

Pull Request Checklist

Task Description/Number

Issue Number: DEV-2304

Basic Requirements

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • fix: represents bug fixes
  • refactor: represents production code refactoring
  • feat: represents a new feature
  • docs: documentation changes (no production code change)
  • chore: maintenance tasks (no production code change)
  • test: all about tests: adding, refactoring tests (no production code change)
  • other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No
  • Maybe (not 100% sure => check with FE)

Does this PR change client-test-data?

  • Yes (don't forget to update the JS-LIB team about the change)
  • No

@mpro7 mpro7 self-assigned this Aug 15, 2023
@linear
Copy link

linear bot commented Aug 15, 2023

DEV-2304 Change default value of the param projectRestrictedViewSize

Reported by Loïc (DCSR, Lausanne):

Hello everybody,

It has been mentioned many times but I can’t a trace of it, so here it comes again:

making default RestrictedViewSettings being "!512,512" barely makes sense.

Only when you look at it in its whole, it is blurred because the full resolution of, let’s say 5120x5120 pixels is reduced to 521x512, then the resolution is reduced to 1%.

When you zoom in half, looking at a picture of 2560x2560 then the resolution is reduced to 4%, zoom a bit more to 1280x1280 the resolution is reduced to 16% of the images, some faces are recognizable, text readable.

And of course, when you are able to zoom in to get a portion of 512x512 pixel, then you see that portion at full resolution!

Just walk your looking glass around and see it all!

So, the default should not be “!512x512” but “pct:1”, the resolution of the image displayed is 1% of the original resolution, whatever the size of the part the image.

Best regards,
Loïc.

https://dasch.atlassian.net/browse/DSQ-211

Related issue: DEV-991

13e21433-568a-4817-8a39-b0effe454ec7

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (12402f3) 18.00% compared to head (2832866) 22.23%.
Report is 74 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2794      +/-   ##
==========================================
+ Coverage   18.00%   22.23%   +4.23%     
==========================================
  Files         281      244      -37     
  Lines       28899    23123    -5776     
==========================================
- Hits         5202     5141      -61     
+ Misses      23697    17982    -5715     

see 171 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mpro7 mpro7 changed the title Dev 2269 fix restricted view default settings (DEV-2269) Dev 2269 fix restricted view default settings (DEV-2304) Aug 15, 2023
@linear
Copy link

linear bot commented Aug 15, 2023

DEV-2304 Change default value of the param projectRestrictedViewSize

the current default value "!512x512" should be changed to "pct:1"

see DEV-2269 for more detail

@mpro7 mpro7 requested a review from seakayone September 5, 2023 13:05
@mpro7 mpro7 marked this pull request as ready for review September 5, 2023 13:05
@mpro7 mpro7 changed the title Dev 2269 fix restricted view default settings (DEV-2304) feat: Add restricted view route (DEV-2304) Sep 5, 2023
@mpro7 mpro7 changed the title feat: Add restricted view route (DEV-2304) feat: Add route that sets size of projectRestrictedViewSetting (DEV-2304) Sep 6, 2023
Copy link
Contributor

@seakayone seakayone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User input must always be sanitized and validated. You cannot just simply take the users String value and put it into a query template. This opens the door for all kind of bad things, e.g. attacks and invalid data being persisted.

Make sure the user input is:

  1. sanitized : the new endpoint is not open for a malicious SPARQL injection
  2. validated: the size value is valid. AFAIU this must be a IIIF size expression

Add documentation for the size parameter. Also check your current documentation its example is GET whilst the endpoint is POST.

@mpro7 mpro7 enabled auto-merge (squash) September 28, 2023 07:24
@mpro7 mpro7 requested a review from seakayone September 28, 2023 07:25
@mpro7 mpro7 disabled auto-merge September 28, 2023 07:58
@mpro7 mpro7 requested a review from seakayone September 29, 2023 10:47
@mpro7 mpro7 enabled auto-merge (squash) September 29, 2023 15:18
@mpro7 mpro7 merged commit 738ab1c into main Sep 29, 2023
@mpro7 mpro7 deleted the dev-2269-fix-restricted-view-default-settings branch September 29, 2023 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants