4 Commits

Author SHA1 Message Date
l-jonas b96c672a8e Update whatsnew 2018-12-16 07:43:50 +01:00
l-jonas 2a25e9882b Release 0.3.10 2018-12-16 07:43:24 +01:00
Jonas L cb33d8f3e4 Update translations 2018-12-15 15:56:41 +01:00
l-jonas db8e91eafa Fix handling file names with spaces for mime type detection (#134)
This fixes https://github.com/syncthing/syncthing-lite/issues/133
2018-12-13 19:44:44 +01:00
8 changed files with 23 additions and 14 deletions
+2 -2
View File
@@ -18,8 +18,8 @@ android {
applicationId "net.syncthing.lite"
minSdkVersion 21
targetSdkVersion 26
versionCode 19
versionName "0.3.9"
versionCode 20
versionName "0.3.10"
multiDexEnabled true
playAccountConfig = playAccountConfigs.defaultAccountConfig
}
@@ -47,7 +47,7 @@ class FileMenuDialogFragment: BottomSheetDialogFragment() {
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = MimeType.getFromUrl(fileSpec.fileName)
type = MimeType.getFromFilename(fileSpec.fileName)
putExtra(Intent.EXTRA_TITLE, fileSpec.fileName)
},
@@ -88,7 +88,7 @@ class DownloadFileDialogFragment : DialogFragment() {
dismissAllowingStateLoss()
if (outputUri == null) {
val mimeType = MimeType.getFromUrl(fileSpec.fileName)
val mimeType = MimeType.getFromFilename(fileSpec.fileName)
try {
context!!.startActivity(
@@ -159,7 +159,7 @@ class SyncthingProvider : DocumentsProvider() {
if (fileInfo.isDirectory())
Document.MIME_TYPE_DIR
else
MimeType.getFromUrl(fileInfo.fileName)
MimeType.getFromFilename(fileInfo.fileName)
)
add(Document.COLUMN_LAST_MODIFIED, fileInfo.lastModified)
add(Document.COLUMN_FLAGS, 0)
@@ -1,6 +1,7 @@
package net.syncthing.lite.utils
import android.webkit.MimeTypeMap
import net.syncthing.java.core.utils.PathUtils
object MimeType {
private const val DEFAULT_MIME_TYPE = "application/octet-stream"
@@ -11,7 +12,7 @@ object MimeType {
return mimeType ?: DEFAULT_MIME_TYPE
}
fun getFromUrl(url: String) = getFromExtension(
MimeTypeMap.getFileExtensionFromUrl(url).toLowerCase()
fun getFromFilename(path: String) = getFromExtension(
PathUtils.getFileExtensionFromFilename(path).toLowerCase()
)
}
+1 -7
View File
@@ -1,7 +1 @@
- update translations
- encrypt some temporarily data which is stored on disk
- update path validation
- fix crash when cleaning the cache
- fix crash of the index handler after cleaning the cache
- convert file extensions to lower case for detecting Apps to open it
- fix crash when accessing (e.g. trying to close) closed connections
- fix file type detection for file names with umlauts and/ or spaces
+6
View File
@@ -59,6 +59,12 @@ fi stocate, dacă vor fi partajate cu terțe entități precum și cum vor fi
<string name="settings_shutdown_delay_30_seconds">30 secunde</string>
<string name="settings_shutdown_delay_1_minute">1 minut</string>
<string name="settings_shutdown_delay_5_minutes">5 minute</string>
<string name="dialog_warning_reconnect_problem">
Datorită modului în care această aplicație și serverul Syncthing funcționează,
nu se poate face reconectarea timp de câteva minute după ce aplicația a fost oprită (ștearsă din lista de aplicații care rulează)
sau conexiunea a fost întreruptă.
Aceasta limitare nu se aplica la conexiunile descoperite local.
</string>
<string name="dialog_file_save_as">Salvează ca</string>
<string name="pending_index_updates">%d actualizări de index în așteptare</string>
<string name="device_status_connecting">Conectare la %s</string>
@@ -130,4 +130,12 @@ object PathUtils {
return dir.removeSuffix(PATH_SEPARATOR) + file
}
fun getFileExtensionFromFilename(filename: String): String {
assertFilenameValid(filename)
val dotIndex = filename.lastIndexOf(".")
return if (dotIndex != 0) filename.substring(dotIndex + 1) else ""
}
}