Stirling-PDF icon indicating copy to clipboard operation
Stirling-PDF copied to clipboard

[Bug]: add-password API is logically inverted?

Open thepebbler opened this issue 8 months ago • 8 comments

Installation Method

Docker fat

The Problem

My head seems to be rejecting the grammar/logical proposition of the add-password API.

basically I wanted to set an owner password to restrict extraction (including accessibility) and disable printing..

So I use the API to set those 3 options to 'false', i.e. canPrint='false' , but the output is the opposite, i.e. canPrint=false means you can print..

Notably the webfront end (http://localhost:8080/add-password?lang=en_GB) has the terms grammatically the other way around 'preventPrinting' etc.. and I wonder if that just needs propogating to the API?

Version of Stirling-PDF

0.45.6

Last Working Version of Stirling-PDF

No response

Page Where the Problem Occurred

'http://localhost:8080/api/v1/security/add-password

Docker Configuration


Relevant Log Output


Additional Information

No response

Browsers Affected

No response

No Duplicate of the Issue

  • [x] I have verified that there are no existing issues raised related to my problem.

thepebbler avatar Apr 25 '25 14:04 thepebbler

you are correct i will fix API description/naming in next release!

Frooodle avatar Apr 25 '25 14:04 Frooodle

can you provide a screenshot

Abhijeet213 avatar Apr 27 '25 16:04 Abhijeet213

No problems, Here is the main UI add password page (http://localhost:8080/add-password?lang=en_GB): Image

Here is the API documentation Image

(Note the inversion of verbiage) And with the API, true/false have the opposite effect to that expected,

i.e. canPrint = true actually creates a PDF you cannot print.

thepebbler avatar Apr 28 '25 06:04 thepebbler

Hi @Abhijeet213, @Frooodle,

I noticed there’s already a PR open however would you mind if I also take a shot at this issue? I noticed the current pull request might need some improvements, and I’d like to try implementing a solution myself.

I think what was already done is not necessary bad but needs some more work at AddPasswordRequest/add-password.html to actually reflect all changes not just in controller but also in the API/Front-end

Please let me know if that’s alright.

Thanks in advance! :)

balazs-szucs avatar Apr 30 '25 19:04 balazs-szucs

PR has only been open 3 days, I don't want to deminnish their work and research into it even if you can also resolve it I have already added a comment in PR https://github.com/Stirling-Tools/Stirling-PDF/pull/3427 As I too believe that it is missing some issues Ideally we would keep language of UI same, since we want to avoid re-translations and instead change variable naming and other system parameters to fix this

Frooodle avatar Apr 30 '25 20:04 Frooodle

Id say wait 4 more days before assuming its stale and picking issue up unless @Abhijeet213 comes back and hands over

Frooodle avatar Apr 30 '25 20:04 Frooodle

I Haven't Changed UI And I don't understand why '!(not)' operator is there after going through full project

For Mean Time - I'm working on error checking and other improvement and need some time..

Abhijeet213 avatar May 01 '25 05:05 Abhijeet213

Hi @Balazs-Szucs ,

You can definitely try this issue from your side No Prob....♾️

  • Abhijeet

Abhijeet213 avatar May 01 '25 05:05 Abhijeet213