mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
chore: add always_put_control_body_on_new_line lint (#28352)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
@@ -42,13 +42,17 @@ String? getServerUrl() {
|
||||
///
|
||||
String punycodeEncodeUrl(String serverUrl) {
|
||||
final serverUri = Uri.tryParse(serverUrl);
|
||||
if (serverUri == null || serverUri.host.isEmpty) return '';
|
||||
if (serverUri == null || serverUri.host.isEmpty) {
|
||||
return '';
|
||||
}
|
||||
|
||||
final encodedHost = Uri.decodeComponent(serverUri.host)
|
||||
.split('.')
|
||||
.map((segment) {
|
||||
// If segment is already ASCII, then return as it is.
|
||||
if (segment.runes.every((c) => c < 0x80)) return segment;
|
||||
if (segment.runes.every((c) => c < 0x80)) {
|
||||
return segment;
|
||||
}
|
||||
return 'xn--${punycodeEncode(segment)}';
|
||||
})
|
||||
.join('.');
|
||||
@@ -75,7 +79,9 @@ String punycodeEncodeUrl(String serverUrl) {
|
||||
///
|
||||
String? punycodeDecodeUrl(String? serverUrl) {
|
||||
final serverUri = serverUrl != null ? Uri.tryParse(serverUrl) : null;
|
||||
if (serverUri == null || serverUri.host.isEmpty) return null;
|
||||
if (serverUri == null || serverUri.host.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final decodedHost = serverUri.host
|
||||
.split('.')
|
||||
|
||||
Reference in New Issue
Block a user