Skip to content

Commit

Permalink
Edge has broken codes for download database
Browse files Browse the repository at this point in the history
  • Loading branch information
JingMatrix committed Jul 26, 2024
1 parent beded34 commit f412167
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/org/matrix/chromext/utils/Url.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ val invalidUserScriptUrls = mutableListOf<String>()
fun isUserScript(url: String?, path: String? = null): Boolean {
if (url == null) return false
if (url.endsWith(".user.js") ||
(Chrome.isEdge && url.endsWith(".js") && url.startsWith("file://"))) {
(Chrome.isEdge &&
url.endsWith(".js") &&
(url.startsWith("file://") || url.startsWith("content://")))) {
if (invalidUserScriptUrls.contains(url)) return false
invalidUserScriptDomains.forEach { if (url.startsWith("https://" + it) == true) return false }
return true
Expand All @@ -92,7 +94,7 @@ fun resolveContentUrl(url: String): String {
val nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)
val dataIndex = cursor.getColumnIndex("_data")
if (dataIndex != -1) {
return cursor.getString(dataIndex)
return cursor.getString(dataIndex) ?: cursor.getString(nameIndex)
} else {
return cursor.getString(nameIndex)
}
Expand Down

0 comments on commit f412167

Please sign in to comment.