mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
commit
eaf115e489
@ -0,0 +1,8 @@
|
|||||||
|
package com.github.libretube.extensions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace file name specific chars
|
||||||
|
*/
|
||||||
|
fun String.sanitize(): String {
|
||||||
|
return this.replace("[^a-zA-Z0-9\\._]+", "_")
|
||||||
|
}
|
@ -18,6 +18,7 @@ import com.github.libretube.constants.DOWNLOAD_FAILURE_NOTIFICATION_ID
|
|||||||
import com.github.libretube.constants.DOWNLOAD_SUCCESS_NOTIFICATION_ID
|
import com.github.libretube.constants.DOWNLOAD_SUCCESS_NOTIFICATION_ID
|
||||||
import com.github.libretube.constants.DownloadType
|
import com.github.libretube.constants.DownloadType
|
||||||
import com.github.libretube.extensions.TAG
|
import com.github.libretube.extensions.TAG
|
||||||
|
import com.github.libretube.extensions.sanitize
|
||||||
import com.github.libretube.util.DownloadHelper
|
import com.github.libretube.util.DownloadHelper
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ class DownloadService : Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||||
videoName = intent?.getStringExtra("videoName")!!
|
videoName = intent?.getStringExtra("videoName")!!.sanitize()
|
||||||
videoUrl = intent.getStringExtra("videoUrl")!!
|
videoUrl = intent.getStringExtra("videoUrl")!!
|
||||||
audioUrl = intent.getStringExtra("audioUrl")!!
|
audioUrl = intent.getStringExtra("audioUrl")!!
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user