Skip to content

Commit

Permalink
Sanitize destination filename from content URI.
Browse files Browse the repository at this point in the history
Fixes #257.
  • Loading branch information
MikuAuahDark committed Dec 23, 2023
1 parent 8a3d635 commit c3ed3b4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions love/src/main/java/org/love2d/android/GameActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ protected void handleIntent(Intent intent) {
filename = pathSegments[pathSegments.length - 1];
}

// Sanitize filename to prevent PhysFS complaining later.
filename = filename.replaceAll("[^a-zA-Z0-9_\\\\-\\\\.]", "_");

String destination_file = this.getCacheDir().getPath() + "/" + filename;
InputStream data = getContentResolver().openInputStream(game);

Expand Down

0 comments on commit c3ed3b4

Please sign in to comment.