OP-Engineering / op-sqlite

Fastest SQLite library for react-native by @ospfranco
MIT License
402 stars 23 forks source link

db.delete tries to delete wrong path when using an absolute location path #92

Closed francescotescari closed 3 weeks ago

francescotescari commented 1 month ago

Describe the bug When calling db.delete on a db with an absolute location path, the underlying database is not deleted because the path passed to the delete function is wrong.

Error: Exception in HostFunction: [op-sqlite]: Database file not found/Users/franz/Library/Developer/CoreSimulator/Devices/696292DB-6A10-499A-BE60-7466EF5DAF90/data/Containers/Data/Application/8AEFF1D1-1C41-4500-BCB4-C2A136093373/Library//Users/franz/Library/Developer/CoreSimulator/Devices/696292DB-6A10-499A-BE60-7466EF5DAF90/data/Containers/Data/Application/8AEFF1D1-1C41-4500-BCB4-C2A136093373/Library/UDB-User13518182+RemoteGraph.sql
    at delete (native)

Versions:

Reproducible example

By looking at the code, the offending lines seem to be these ones: if we specify an absolute path in the location, the delete method is going to concatenate it to the base path, creating an invalid path.

ospfranco commented 1 month ago

thanks! I will take a look in a bit!

ospfranco commented 1 month ago

5.0.6 is out and should fix the issue

ospfranco commented 3 weeks ago

Closing this, issue should be fixed