mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-04 08:34:12 +00:00
Strip all whitespace from pasted IDs, not only spaces (#16762)
This commit is contained in:
1 parent
e1ca09766c
commit
cda3847337
2 files changed
+51
-2
No files matched your search
@@ -33,8 +33,13 @@ class IDTextInputFormatter extends TextInputFormatter {
|
||||
}
|
||||
}
|
||||
|
||||
// Pasted IDs can carry a trailing newline or tab (e.g. copied from a
|
||||
// spreadsheet cell) or non-breaking spaces, so strip all whitespace, not only
|
||||
// plain spaces.
|
||||
final _whitespace = RegExp(r'\s');
|
||||
|
||||
String formatID(String id) {
|
||||
String id2 = id.replaceAll(' ', '');
|
||||
String id2 = id.replaceAll(_whitespace, '');
|
||||
String suffix = '';
|
||||
if (id2.endsWith(r'\r') || id2.endsWith(r'/r')) {
|
||||
suffix = id2.substring(id2.length - 2, id2.length);
|
||||
@@ -56,5 +61,5 @@ String formatID(String id) {
|
||||
}
|
||||
|
||||
String trimID(String id) {
|
||||
return id.replaceAll(' ', '');
|
||||
return id.replaceAll(_whitespace, '');
|
||||
}
|
||||
Reference in new issue
Block a user