fix: bad javascript string escaping in EMS
fix: Unable to upload images or edit listings for Matrix
This commit is contained in:
parent
9c6ca80302
commit
1ceb7abb02
3 changed files with 15 additions and 24 deletions
|
|
@ -15,6 +15,8 @@
|
||||||
description from the RSS feed.
|
description from the RSS feed.
|
||||||
- Added an index on the userId column of the groupings table to speed up
|
- Added an index on the userId column of the groupings table to speed up
|
||||||
queries for groupIds by userId (instead of the usual userIds by groupId)
|
queries for groupIds by userId (instead of the usual userIds by groupId)
|
||||||
|
- fix: bad javascript string escaping in EMS
|
||||||
|
- fix: Unable to upload images or edit listings for Matrix
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -327,9 +327,13 @@ sub buildMenu {
|
||||||
my $fieldList = "";
|
my $fieldList = "";
|
||||||
foreach my $key (keys %{$list}) {
|
foreach my $key (keys %{$list}) {
|
||||||
$fieldList .= "," if($fieldList ne "");
|
$fieldList .= "," if($fieldList ne "");
|
||||||
|
my $js_key = $key;
|
||||||
|
$js_key =~ s/\\/\\\\/g;
|
||||||
|
$js_key =~ s/"/\\"/g;
|
||||||
my $value = $list->{$key};
|
my $value = $list->{$key};
|
||||||
$value =~ s/"/\"/g;
|
$value =~ s/\\/\\\\/g;
|
||||||
$fieldList .= qq|"$key":"$value"|
|
$value =~ s/"/\\"/g;
|
||||||
|
$fieldList .= qq|"$js_key":"$value"|
|
||||||
}
|
}
|
||||||
$js .= qq| ,"list":{ $fieldList }|;
|
$js .= qq| ,"list":{ $fieldList }|;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -690,27 +690,12 @@ sub www_editListingSave {
|
||||||
description => $self->session->form->process("description"),
|
description => $self->session->form->process("description"),
|
||||||
versionNumber=>$self->session->form->process("versionNumber")
|
versionNumber=>$self->session->form->process("versionNumber")
|
||||||
);
|
);
|
||||||
my $storage = undef;
|
|
||||||
if ($listing->{storageId} ne "") {
|
|
||||||
$storage = WebGUI::Storage::Image->get($self->session, $listing->{storageId});
|
|
||||||
} else {
|
|
||||||
$storage = WebGUI::Storage::Image->create($self->session);
|
|
||||||
$data{storageId} = $storage->getId;
|
|
||||||
}
|
|
||||||
|
|
||||||
##This is a hack. File upload should go throught the WebGUI::Form::File API
|
my $storageId = WebGUI::Form::Image->new($self->session,{name => 'screenshot', value => $listing->{storageId}})->getValueFromPost;
|
||||||
##so that future changes don't affect us like this
|
if ($storageId) {
|
||||||
my $screenshotStorageId = WebGUI::Form::File->new($self->session,{name => 'screenshot'})->getValueFromPost;
|
$data{storageId} = $storageId;
|
||||||
my $uploadedScreenshot = WebGUI::Storage->get($self->session, $screenshotStorageId);
|
$data{filename} = WebGUI::Storage->get($self->session, $storageId)->getFiles->[0];
|
||||||
my $screenshot = $uploadedScreenshot->addFileFromFormPost("screenshot");
|
}
|
||||||
|
|
||||||
if (defined $screenshot) {
|
|
||||||
$data{filename} = $screenshot;
|
|
||||||
$storage->generateThumbnail($screenshot);
|
|
||||||
$storage->addFileFromFilesystem($uploadedScreenshot->getPath($screenshot));
|
|
||||||
}
|
|
||||||
|
|
||||||
$uploadedScreenshot->delete;
|
|
||||||
|
|
||||||
my $productName = $self->session->form->process("productName");
|
my $productName = $self->session->form->process("productName");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue