Torann / laravel-geoip

Determine the geographical location of website visitors based on their IP addresses.
http://lyften.com/projects/laravel-geoip
BSD 2-Clause "Simplified" License
2.07k stars 372 forks source link

Update MaxMindDatabase.php #172

Closed jalmatari closed 4 years ago

jalmatari commented 4 years ago

It's show error in some cases when Working in multi branches, this edit fixes the problem

dwightwatson commented 4 years ago

This update has broken MaxMindDatabase for me.

[2020-03-09 23:23:40] testing.ERROR: mkdir(): File exists {"exception":"[object] (ErrorException(code: 0): mkdir(): File exists at /Users/Dwight/Sites/my-app/vendor/torann/geoip/src/Services/MaxMindDatabase.php:29)

This is with the default configuration. Out of the box the path is storage/app/geoip.mmdb, your call to str_replace turns this into storage/app and then tries to create that directory, which already exists.

This PR should be reverted, and made again if necessary with a proper explanation of the error that is being seen and relevant tests to ensure it isn't breaking existing functionality.