From c90f658bfe87680d2954f22913fb3e3e3d041c4a Mon Sep 17 00:00:00 2001 From: OneWay Date: Sun, 27 Sep 2026 12:30:00 +0800 Subject: [PATCH] fix(settings): accept dictionary source URLs over https only The platform blocks cleartext traffic by default, so an http:// source passed validation but could never download and failed with a misleading network error. The validator now rejects http:// upfront. --- .../com/example/research/core/domain/model/DictionarySource.kt | 2 +- app/src/main/res/values-ru/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/example/research/core/domain/model/DictionarySource.kt b/app/src/main/java/com/example/research/core/domain/model/DictionarySource.kt index a48d9da..ab7c568 100644 --- a/app/src/main/java/com/example/research/core/domain/model/DictionarySource.kt +++ b/app/src/main/java/com/example/research/core/domain/model/DictionarySource.kt @@ -106,7 +106,7 @@ data class DictionarySource( return when { trimmed.isBlank() -> ValidationResult.Error(ValidationError.EMPTY) trimmed.length > 2048 -> ValidationResult.Error(ValidationError.TOO_LONG) - !trimmed.startsWith("http://") && !trimmed.startsWith("https://") -> + !trimmed.startsWith("https://") -> ValidationResult.Error(ValidationError.INVALID_PROTOCOL) !lowerTemplate.endsWith(".gz") && !lowerTemplate.endsWith(".dsl") && diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 55dd6c7..1ce298e 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -76,7 +76,7 @@ Дублирующийся URL в форме Этот словарь уже существует (одинаковый префикс) URL не может быть пустым - Должен начинаться с http:// или https:// + Должен начинаться с https:// Должен заканчиваться на .gz, .dsl или .dsl.dz URL слишком длинный (максимум 2048 символов) Неверный формат URL diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7c151db..f2b5ec5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -74,7 +74,7 @@ Duplicate URL in the form This dictionary already exists URL cannot be empty - Must start with http:// or https:// + Must start with https:// Must end with .gz, .dsl, or .dsl.dz URL is too long (max 2048 characters) Invalid URL format