Skip to content

Commit f412167

Browse files
committed
Edge has broken codes for download database
See #156 (comment)
1 parent beded34 commit f412167

File tree

1 file changed

+4
-2
lines changed
  • app/src/main/java/org/matrix/chromext/utils

1 file changed

+4
-2
lines changed

app/src/main/java/org/matrix/chromext/utils/Url.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ val invalidUserScriptUrls = mutableListOf<String>()
7676
fun isUserScript(url: String?, path: String? = null): Boolean {
7777
if (url == null) return false
7878
if (url.endsWith(".user.js") ||
79-
(Chrome.isEdge && url.endsWith(".js") && url.startsWith("file://"))) {
79+
(Chrome.isEdge &&
80+
url.endsWith(".js") &&
81+
(url.startsWith("file://") || url.startsWith("content://")))) {
8082
if (invalidUserScriptUrls.contains(url)) return false
8183
invalidUserScriptDomains.forEach { if (url.startsWith("https://" + it) == true) return false }
8284
return true
@@ -92,7 +94,7 @@ fun resolveContentUrl(url: String): String {
9294
val nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)
9395
val dataIndex = cursor.getColumnIndex("_data")
9496
if (dataIndex != -1) {
95-
return cursor.getString(dataIndex)
97+
return cursor.getString(dataIndex) ?: cursor.getString(nameIndex)
9698
} else {
9799
return cursor.getString(nameIndex)
98100
}

0 commit comments

Comments
 (0)