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

crashes for deviantart robots.txt #1

Closed
iyzana opened this issue Feb 8, 2021 · 2 comments
Closed

crashes for deviantart robots.txt #1

iyzana opened this issue Feb 8, 2021 · 2 comments

Comments

@iyzana
Copy link

iyzana commented Feb 8, 2021

When parsing https://www.deviantart.com/robots.txt

User-agent: *
Disallow: /*q=
Disallow: /users/*?
Disallow: /join/*?
Disallow: /morelikethis/
Disallow: /download/
Disallow: /checkout/
Disallow: /global/
Disallow: /api/
Disallow: /critiques/
 
Sitemap: http://sitemaps.deviantart.net/sitemap-index.xml.gz

the parser fails with

thread 'main' panicked at 'assertion failed: !val.is_empty()', /home/me/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/robotstxt-0.2.0/src/parser.rs:207:17

Reproduction:

use robotstxt::DefaultMatcher;

fn main() {
    let robots_content = r#"User-agent: *
Disallow: /*q=
Disallow: /users/*?
Disallow: /join/*?
Disallow: /morelikethis/
Disallow: /download/
Disallow: /checkout/
Disallow: /global/
Disallow: /api/
Disallow: /critiques/
 
Sitemap: http://sitemaps.deviantart.net/sitemap-index.xml.gz"#;
    let mut matcher = DefaultMatcher::default();
    matcher.one_agent_allowed_by_robots(&robots_content, "oldnews", "https://www.deviantart.com/");
}

I'm assuming it is because of the line between the Disallows and the Sitemap, which only contains a single space.

@iyzana
Copy link
Author

iyzana commented Feb 8, 2021

It seems someone else patched this bug on their fork:
scascketta@ffe972d

@Folyd Folyd closed this as completed in 67475a1 Feb 12, 2021
@Folyd
Copy link
Owner

Folyd commented Feb 12, 2021

Hi @iyzana. Hugely thanks for your feedback. 👍 This has been fixed via 67475a1.

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

No branches or pull requests

2 participants