This commit is contained in:
Xwite 2023-03-25 11:53:10 +08:00
parent e527b7fb5d
commit 99582dfcd7
2 changed files with 5 additions and 3 deletions

View File

@ -173,7 +173,7 @@ interface JsExtensions : JsEncodeUtils {
*/
fun importScript(path: String): String {
val result = when {
path.startsWith("http") -> cacheFile(path) ?: ""
path.startsWith("http") -> cacheFile(path)
path.isUri() -> Uri.parse(path).readText(appCtx)
path.startsWith("/storage") -> FileUtils.readText(path)
else -> readTxtFile(path)
@ -187,7 +187,7 @@ interface JsExtensions : JsEncodeUtils {
* @param urlStr 网络文件的链接
* @return 返回缓存后的文件内容
*/
fun cacheFile(urlStr: String): String? {
fun cacheFile(urlStr: String): String {
return cacheFile(urlStr, 0)
}

View File

@ -24,7 +24,9 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo
val fileDoc = FileDoc.fromUri(uri, false)
fileName = fileDoc.name
if (fileName.matches(AppPattern.archiveFileRegex)) {
ArchiveUtils.deCompress(fileDoc).forEach {
ArchiveUtils.deCompress(fileDoc, ArchiveUtils.TEMP_PATH) {
it.matches(bookFileRegex)
}.forEach {
dispatch(FileDoc.fromFile(it))
}
} else {