Checks if the link contains the parameter instead of ends with it
To know if the gate should be bypassed, we check if the link contains the pasameter instead of checking if the link ends with it. This is impostant, for example if we were to implement searching for comments within a post. If we wanted to search for comments within a post that we have bypassed the gate to view: the link will look like https://libreddit-instance/r/somesub/comments/post-id/post-title&bypass_nsfw_landing/?q=some-query&type=comment
This commit is contained in:
parent
a0726c5903
commit
8be69f6fe5
1 changed files with 1 additions and 1 deletions
|
@ -899,7 +899,7 @@ pub fn should_be_nsfw_gated(req: &Request<Body>, req_url: &String) -> bool {
|
|||
let gate_nsfw = (setting(&req, "show_nsfw") != "on") || sfw_instance;
|
||||
|
||||
// Nsfw landing gate should not be bypassed on a sfw only instance,
|
||||
let bypass_gate = !sfw_instance && req_url.ends_with("&bypass_nsfw_landing");
|
||||
let bypass_gate = !sfw_instance && req_url.contains("&bypass_nsfw_landing");
|
||||
|
||||
gate_nsfw && !bypass_gate
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue