Commit 33a9af4 1 parent a7272c0 commit 33a9af4 Copy full SHA for 33a9af4
File tree 4 files changed +8
-6
lines changed
app/src/main/java/com/infomaniak/drive
4 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,10 @@ import com.infomaniak.drive.data.models.file.FileConversion
33
33
import com.infomaniak.drive.data.models.file.FileExternalImport
34
34
import com.infomaniak.drive.data.models.file.FileExternalImport.FileExternalImportStatus
35
35
import com.infomaniak.drive.data.models.file.FileVersion
36
- import com.infomaniak.drive.utils.AccountUtils
37
- import com.infomaniak.drive.utils.IOFile
36
+ import com.infomaniak.drive.utils.*
38
37
import com.infomaniak.drive.utils.RealmListParceler.*
39
38
import com.infomaniak.drive.utils.Utils.INDETERMINATE_PROGRESS
40
39
import com.infomaniak.drive.utils.Utils.ROOT_ID
41
- import com.infomaniak.drive.utils.downloadFile
42
40
import com.infomaniak.lib.core.utils.contains
43
41
import com.infomaniak.lib.core.utils.guessMimeType
44
42
import io.realm.RealmList
@@ -240,7 +238,7 @@ open class File(
240
238
return if (extension == name) null else " .$extension "
241
239
}
242
240
243
- fun isBookmark () = name.endsWith( " .url " ) || name.endsWith( " .webloc " )
241
+ fun isBookmark () = name.isUrlFile( ) || name.isWeblocFile( )
244
242
245
243
fun isPendingUploadFolder () = isFromUploads && isFolder()
246
244
Original file line number Diff line number Diff line change @@ -450,7 +450,7 @@ class SaveExternalFilesActivity : BaseActivity() {
450
450
if (outputFile.createNewFile()) {
451
451
outputFile.setLastModified(lastModified.time)
452
452
453
- if (fileName.endsWith( " .url " )) { // Create url file
453
+ if (fileName.isUrlFile( )) { // Create url file
454
454
// See URL format http://www.lyberty.com/encyc/articles/tech/dot_url_format_-_an_unofficial_guide.html
455
455
outputFile.outputStream().use { output ->
456
456
output.write(" [InternetShortcut]" .toByteArray())
Original file line number Diff line number Diff line change @@ -551,3 +551,7 @@ fun MainActivity.showQuotasExceededSnackbar(navController: NavController) {
551
551
onActionClicked = { navController.openMyKSuiteUpgradeBottomSheet(KSuiteApp .Drive ) },
552
552
)
553
553
}
554
+
555
+ fun String.isUrlFile () = endsWith(" .url" , ignoreCase = true )
556
+
557
+ fun String.isWeblocFile () = endsWith(" .webloc" , ignoreCase = true )
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ object FilePresenter {
127
127
128
128
suspend fun Context.openBookmarkIntent (fileName : String , uri : Uri ) {
129
129
val url = withContext(Dispatchers .IO ) {
130
- if (fileName.endsWith( " .url " )) {
130
+ if (fileName.isUrlFile( )) {
131
131
getUrlFromUrlFile(context = this @openBookmarkIntent, uri)
132
132
} else {
133
133
getUrlFromWebloc(context = this @openBookmarkIntent, uri)
You can’t perform that action at this time.
0 commit comments