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

Set enforce_https to false on the CLI #727

Closed
plaindocs opened this issue Jul 14, 2022 · 10 comments · Fixed by #728
Closed

Set enforce_https to false on the CLI #727

plaindocs opened this issue Jul 14, 2022 · 10 comments · Fixed by #728
Assignees

Comments

@plaindocs
Copy link
Contributor

From the 3->4 changelog

check_img_http was removed. All URLs are expected to be HTTPS; set enforce_https to false if you prefer keeping HTTP images around

Is that possible using the CLI? When using --enforce-https=false I get

/usr/local/share/gems/gems/mercenary-0.4.0/lib/mercenary/program.rb:33:in `go': needless argument: --enforce-https=false (OptionParser::NeedlessArgument)
	from /usr/local/share/gems/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
	from /usr/local/share/gems/gems/html-proofer-4.0.1/bin/htmlproofer:11:in `<top (required)>'
	from /usr/local/bin/htmlproofer:25:in `load'
	from /usr/local/bin/htmlproofer:25:in `<main>'
@JackWilb
Copy link
Contributor

I'm also having this problem. Using --enforce-https false doesn't work either. It gives:

Error:  false does not exist

I assume the syntax from the issue description is the correct one

@JackWilb
Copy link
Contributor

Another note, this problem seems to also occur for --check-external-hash=false. Maybe this is a larger issue with boolean CLI parameters

@gjtorikian
Copy link
Owner

Whoops, thanks for the report. 4.1 should fix this.

@plaindocs
Copy link
Contributor Author

Thanks @gjtorikian you're a 🌟

@Atarity
Copy link

Atarity commented Nov 29, 2022

Still the same on 5.0.2 . In CLI below command was OK with 4.4.0

htmlproofer _site/ --extension .html --assume-extension .html --checks Links,Images,Scripts,OpenGraph --swap-attributes '{"img": [["src", "data-src"]] }' --enforce-https=false --ignore-status-codes 999,401 --disable-external=true --swap-urls www.mysite.com:localhost:4000

--disable-external=true also an issue.

@ModischFabrications
Copy link

Came here for the same error, might want to add something to the readme 😄

@gjtorikian
Copy link
Owner

5.x fixed this to make more logical sense and restore old behavior. Try

--disable-external true

(In other words, no =.)

@Atarity
Copy link

Atarity commented Nov 30, 2022

I've tried this without = → false does not exist (ArgumentError).

ruby 3.1.3, html-proofer 5.0.2

@gjtorikian gjtorikian reopened this Nov 30, 2022
@gjtorikian
Copy link
Owner

Looking into it!

@gjtorikian gjtorikian self-assigned this Nov 30, 2022
@gjtorikian
Copy link
Owner

Ah, I misread the original issue.

In 5.0, the commands changed:

  • --no-enforce-https: this is equivalent to the old enforce_https = false
  • --disable-external: this is equivalent to the old disable-external = true

This was done so that boolean expressions could use the --[no-]* syntax, which is common across Ruby CLI. Hope that helps!

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 a pull request may close this issue.

5 participants