cyu / rack-cors

Rack Middleware for handling Cross-Origin Resource Sharing (CORS), which makes cross-origin AJAX possible.
MIT License
3.27k stars 262 forks source link

README is incorrect about path patterns #175

Closed grncdr closed 3 years ago

grncdr commented 5 years ago

The README states:

A Resource path can be specified as exact string match (/path/to/file.txt) or with a '*' wildcard (/all/files/in/*). To include all of a directory's files and the files in its subdirectories, use this form: /assets/*/. A resource can take the following options:

However, Rack::Cors::Resource#compile will turn the string "/assets/**/*" into the regex /^#{"/assets/(.*?)(.*?)/(.*?)"}$/ which does not match "/assets/some-file.whatever".

It's unclear to me if maybe there was a path globbing lib in the past, or if the docs were always wrong, but maybe the docs should be changed to suggest "/assets/*" instead.

cyu commented 3 years ago

Done [908ea29e1b0fdc4c6091ccb4eb92b6de1e370387]

Thanks!