Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 588033f1 authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #8293 from cketti/fix_K9WorkerFactory

Change `K9WorkerFactory` to not load classes outside of our namespace
parents ae30928c f58df375
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -13,6 +13,11 @@ class K9WorkerFactory : WorkerFactory() {
        workerClassName: String,
        workerParameters: WorkerParameters,
    ): ListenableWorker? {
        // Don't attempt to load classes outside of our namespace.
        if (!workerClassName.startsWith("com.fsck.k9")) {
            return null
        }

        val workerClass = Class.forName(workerClassName).kotlin
        return getKoin().getOrNull(workerClass) { parametersOf(workerParameters) }
    }
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ import com.fsck.k9.controller.MessagingController
import com.fsck.k9.mail.AuthType
import timber.log.Timber

// IMPORTANT: Update K9WorkerFactory when moving this class and the FQCN no longer starts with "com.fsck.k9".
class MailSyncWorker(
    private val messagingController: MessagingController,
    private val preferences: Preferences,
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ import com.fsck.k9.ui.R
/**
 * A [Worker] to remove an account in the background.
 */
// IMPORTANT: Update K9WorkerFactory when moving this class and the FQCN no longer starts with "com.fsck.k9".
class AccountRemoverWorker(
    private val accountRemover: AccountRemover,
    private val notificationController: BackgroundWorkNotificationController,