mirror of
https://github.com/webmin/webmin.git
synced 2026-09-09 07:00:40 +01:00
Fix to quote directive values containing #
ⓘ Values with a # were written unquoted, so on the next read the module took the # as the start of a comment and lost the rest of the line. For example, a redirect saved as return 301 https://example.com/docs#install; then showed as no redirect on the page, and re-saving it added a duplicate rewrite_log directive that Nginx rejected. So, before the fix, saving a redirect to https://example.com/docs#install wrote: return 301 https://example.com/docs#install; rewrite_log off; On the next read the module dropped everything after the #, so it saw one merged line: return 301 https://example.com/docs rewrite_log off; The redirect disappeared from the page, and saving again appended a second rewrite_log off;, which Nginx rejects as a duplicate. After the fix the same save writes: return 301 "https://example.com/docs#install"; rewrite_log off; Nginx treats the quoted and unquoted forms identically, and the module reads it back correctly.
This commit is contained in:
@@ -731,13 +731,15 @@ sub join_words
|
||||
{
|
||||
my @rv;
|
||||
foreach my $w (@_) {
|
||||
# Quote words with spaces, separators, variables or a # comment marker
|
||||
my $quote = $w =~ /\s|;|\$/ && $w !~ /^\$/ || $w =~ /#/;
|
||||
if ($w eq "") {
|
||||
push(@rv, '""');
|
||||
}
|
||||
elsif ($w =~ /\s|;|\$/ && $w !~ /"/ && $w !~ /^\$/) {
|
||||
elsif ($quote && $w !~ /"/) {
|
||||
push(@rv, "\"$w\"");
|
||||
}
|
||||
elsif ($w =~ /\s|;|\$/ && $w !~ /^\$/) {
|
||||
elsif ($quote) {
|
||||
push(@rv, "'$w'");
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user