fix: bad javascript string escaping in EMS

fix: Unable to upload images or edit listings for Matrix
This commit is contained in:
Graham Knop 2007-05-29 21:30:07 +00:00
parent 9c6ca80302
commit 1ceb7abb02
3 changed files with 15 additions and 24 deletions

View file

@ -15,6 +15,8 @@
description from the RSS feed.
- 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)
- fix: bad javascript string escaping in EMS
- fix: Unable to upload images or edit listings for Matrix

View file

@ -327,9 +327,13 @@ sub buildMenu {
my $fieldList = "";
foreach my $key (keys %{$list}) {
$fieldList .= "," if($fieldList ne "");
my $js_key = $key;
$js_key =~ s/\\/\\\\/g;
$js_key =~ s/"/\\"/g;
my $value = $list->{$key};
$value =~ s/"/\"/g;
$fieldList .= qq|"$key":"$value"|
$value =~ s/\\/\\\\/g;
$value =~ s/"/\\"/g;
$fieldList .= qq|"$js_key":"$value"|
}
$js .= qq| ,"list":{ $fieldList }|;
}

View file

@ -690,28 +690,13 @@ sub www_editListingSave {
description => $self->session->form->process("description"),
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
##so that future changes don't affect us like this
my $screenshotStorageId = WebGUI::Form::File->new($self->session,{name => 'screenshot'})->getValueFromPost;
my $uploadedScreenshot = WebGUI::Storage->get($self->session, $screenshotStorageId);
my $screenshot = $uploadedScreenshot->addFileFromFormPost("screenshot");
if (defined $screenshot) {
$data{filename} = $screenshot;
$storage->generateThumbnail($screenshot);
$storage->addFileFromFilesystem($uploadedScreenshot->getPath($screenshot));
}
$uploadedScreenshot->delete;
my $storageId = WebGUI::Form::Image->new($self->session,{name => 'screenshot', value => $listing->{storageId}})->getValueFromPost;
if ($storageId) {
$data{storageId} = $storageId;
$data{filename} = WebGUI::Storage->get($self->session, $storageId)->getFiles->[0];
}
my $productName = $self->session->form->process("productName");
my $isNew = 0;