Ver código fonte

Fix HTML pattern in install (#7009)

Slashes now need to be escaped because of `v` mode:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_class#v-mode_character_class

https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern#overview

Edge:
> Pattern attribute value [0-9A-Z/a-z_.\-]{1,64}(:[0-9]{2,5})? is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /[0-9A-Z/a-z_.\-]{1,64}(:[0-9]{2,5})?/v: Invalid character in character class

Firefox:
> Impossible de vérifier <input pattern='[0-9A-Z/a-z_.\-]{1,64}(:[0-9]{2,5})?'> car « /[0-9A-Z/a-z_.\-]{1,64}(:[0-9]{2,5})?/v » n’est pas une expression régulière valide : invalid character in class in regular expression
Alexandre Alapetite 1 ano atrás
pai
commit
0f4bcdad9b
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1 1
      app/install.php

+ 1 - 1
app/install.php

@@ -551,7 +551,7 @@ function printStep2(): void {
 		<div class="form-group">
 			<label class="group-name" for="host"><?= _t('install.bdd.host') ?></label>
 			<div class="group-controls">
-				<input type="text" id="host" name="host" pattern="[0-9A-Z/a-z_.\-]{1,64}(:[0-9]{2,5})?" value="<?=
+				<input type="text" id="host" name="host" pattern="[0-9A-Z\/a-z_.\-]{1,64}(:[0-9]{2,5})?" value="<?=
 					$_SESSION['bd_host'] ?? $system_default_config->db['host'] ?? '' ?>" tabindex="2" />
 			</div>
 		</div>