yihui / mime

Map filenames to MIME types
https://cran.rstudio.com/package=mime
32 stars 15 forks source link

grep returns a warning #21

Open JosiahParry opened 3 months ago

JosiahParry commented 3 months ago

The use of grep here returns a warning for long strings. I am uploading a tar.gz and accessing it using mime. Each time the bundle is accessed I get this warning.

I'm not too sure what is causing the message but it would be nice to be able to not have to run suppressWarnings()

Warning in grep(rfc2183, head, perl = TRUE) : PCRE error
        'match limit exceeded'
        for element 1

https://github.com/yihui/mime/blob/1763e0dcb72fb58d97bab97bb834fc71f1e012bc/R/parse.R#L24

yihui commented 3 months ago

Yes, we could just suppressWarnings() here: https://github.com/yihui/mime/blob/1763e0dcb72fb58d97bab97bb834fc71f1e012bc/R/parse.R#L118

but it would be nice to truly understand what the problem is. I don't know what this warning means or what the code is doing here (this part of code was written by @jeffreyhorner, who I believe has left the R community long time ago).