Convert a small HTML fragment into plain text.
(value: str)
| 586 | """Reject URLs that point at the local host or a private network. |
| 587 | |
| 588 | --homepage-url and --scholar-url are fetched server-side, so without this a |
| 589 | URL like http://127.0.0.1:8765/api/settings or a cloud metadata endpoint |
| 590 | (169.254.169.254) would be requested by PaperFlow and its response folded |
| 591 | into the profile. Only http/https are allowed, and the hostname is resolved |
| 592 | first because a public name can still map to a private address. |
| 593 | |
| 594 | Set PAPERFLOW_ALLOW_PRIVATE_FETCH=1 if you host your homepage on the local |
| 595 | network and understand the implication. |
| 596 | """ |
| 597 | if str(os.environ.get("PAPERFLOW_ALLOW_PRIVATE_FETCH", "")).strip().lower() in {"1", "true", "yes", "on"}: |
no test coverage detected