mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
wireguard.cgi: missed normalize sub in header.pl
commit 37174e29de670a33f9be4b90c88b0a96c695dad1
Author: Michael Tremer <michael.tremer@ipfire.org>
Date: Fri Sep 27 17:55:46 2024 +0200
wireguard.cgi: Normalize filenames
This is because Windows clients won't import any configurations that
have spaces in the filename. Therefore we replace it and remove anything
else unwanted on the way.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
@@ -16,6 +16,7 @@ use File::Basename;
|
||||
use HTML::Entities();
|
||||
use Socket;
|
||||
use Time::Local;
|
||||
use Unicode::Normalize;
|
||||
|
||||
our %color = ();
|
||||
&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
|
||||
@@ -363,6 +364,18 @@ sub escape($) {
|
||||
return HTML::Entities::encode_entities($s);
|
||||
}
|
||||
|
||||
sub normalize($) {
|
||||
my $s = shift;
|
||||
|
||||
# Remove any special characters
|
||||
$s = &Unicode::Normalize::NFKD($s);
|
||||
|
||||
# Remove any whitespace and replace with dash
|
||||
$s =~ s/\s+/\-/g;
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
sub cleanhtml {
|
||||
my $outstring =$_[0];
|
||||
$outstring =~ tr/,/ / if not defined $_[1] or $_[1] ne 'y';
|
||||
|
||||
Reference in New Issue
Block a user