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
fix: Parse SDK internal database file parse.db
is accessible for app user on iOS and may be accidentally deleted
#826
Conversation
…be deleted on ios
Thanks for opening this pull request!
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #826 +/- ##
==========================================
+ Coverage 15.82% 16.38% +0.56%
==========================================
Files 47 47
Lines 2876 2899 +23
==========================================
+ Hits 455 475 +20
- Misses 2421 2424 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@mtrezza @mbfakourii Friendly ping about this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtrezza @mbfakourii Friendly ping about this PR
Unfortunately, I don't have a Mac system to check, but the code has no logic problems and looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #791 (comment)
…d add copy migration algorithm
@mtrezza Parse-SDK-Flutter/packages/flutter/lib/parse_server_sdk.dart Lines 138 to 142 in a19ea87
so we need to use the Future<String> dbDirectory() async {
final dbDirectory = await CoreStoreDirectory().getDatabaseDirectory();
return path.join(
dbDirectory,
'parse',
'parse.db',
);
} What do you think? Should I fix this in this PR or open a new issue with a new PR for it? |
A new issue would be great. I think we also need to look at this bug separately and I think it merits a separate changelog entry and release. It may even be a breaking change for Windows systems if the fix creates a different path for the file. Not sure what happens with the current bug on Windows. |
In our case yes it is because we use
Got it you are right
I do not think so! an exception will be thrown I think. I will try it tomorrow and see what will happen. also, this PR is ready to be merged. I will bump the Flutter SDK version to |
parse.db
is accessible for app user and may be accidentally deleted
parse.db
is accessible for app user and may be accidentally deletedparse.db
is accessible for app user on iOS and may be accidentally deleted
I've modified the PR title, could you please review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor cleanup
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
packages/flutter/test/src/storage/core_store_directory_io_test.dart
Outdated
Show resolved
Hide resolved
@mtrezza LGTM |
I test the path on It looks like As you can see this is not normal at all: If it's working on Windows 10 then I am positive that it will work on Windows 11. But I am not sure what will happen on Windows 8 and Windows 7 |
Thanks for the lint fix.
I think what's going on here is that while historically in MS-DOS it was not a directory operator, at some point (probably many years back) the path interpreter has been updated to accept forward slashes as well. Probably in the context of URI handling which uses forward slashes. Hence the path you mention is correctly interpreted. I tried this in MS-DOS 6.22 and it's interpreted as a command switch as expected. If you try it in a Windows command prompt and type I think we are good to merge since you tested it and it worked. I agree with your earlier comment that it will either work or fail because of an invalid path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
The CI passed merging, but publishing failed, see #835. |
New Pull Request Checklist
Issue Description
Closes: #791
Approach
Using LibraryDirectory as a path for the database.
TODOs before merging
This is a breaking change for ios platform because the SDK now will look for the "parse.db" in the
LibraryDirectory
rather than theApplicationDocumentsDirectory
.We can support the old directory path by doing something like: