Fix HTTP Proxy asset file uploads.
This commit is contained in:
parent
bb360794c1
commit
e8fd02ca9e
3 changed files with 16 additions and 13 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
7.0.9
|
||||||
|
- partial fix: invalid Message-ID headers in outgoing mail
|
||||||
|
- fix: HttpProxy not doing file uploads correctly
|
||||||
|
|
||||||
7.0.8
|
7.0.8
|
||||||
- Fixed a couple of minor bugs with the default values of the Request
|
- Fixed a couple of minor bugs with the default values of the Request
|
||||||
Approval for Version Tag workflow activity.
|
Approval for Version Tag workflow activity.
|
||||||
|
|
@ -34,7 +38,6 @@
|
||||||
- fix: attachments section of post form not working correctly on edit
|
- fix: attachments section of post form not working correctly on edit
|
||||||
- Images now create revisions as you resize them, so you can roll back to a
|
- Images now create revisions as you resize them, so you can roll back to a
|
||||||
previous size.
|
previous size.
|
||||||
- partial fix: invalid Message-ID headers in outgoing mail
|
|
||||||
|
|
||||||
7.0.7
|
7.0.7
|
||||||
- rfe: Image Management (funded by Formation Design Systems)
|
- rfe: Image Management (funded by Formation Design Systems)
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ use WebGUI::Session;
|
||||||
use WebGUI::User;
|
use WebGUI::User;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
use WebGUI::PassiveProfiling;
|
use WebGUI::PassiveProfiling;
|
||||||
|
use Apache2::Upload;
|
||||||
use Apache2::Request;
|
use Apache2::Request;
|
||||||
use Apache2::RequestRec ();
|
use Apache2::RequestRec ();
|
||||||
use Apache2::RequestIO ();
|
use Apache2::RequestIO ();
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ sub view {
|
||||||
$cookiebox =~ s/[^A-Za-z0-9\-\.\_]//g; #removes all funky characters
|
$cookiebox =~ s/[^A-Za-z0-9\-\.\_]//g; #removes all funky characters
|
||||||
$cookiebox .= '.cookie';
|
$cookiebox .= '.cookie';
|
||||||
my $jar = HTTP::Cookies->new(File => $self->getCookieJar->getPath($cookiebox), AutoSave => 1, Ignore_Discard => 1);
|
my $jar = HTTP::Cookies->new(File => $self->getCookieJar->getPath($cookiebox), AutoSave => 1, Ignore_Discard => 1);
|
||||||
my (%var, %formdata, @formUpload, $redirect, $response, $header, $userAgent, $proxiedUrl, $request);
|
my (%var, %formdata, $redirect, $response, $header, $userAgent, $proxiedUrl, $request);
|
||||||
|
|
||||||
if($self->session->form->param("func")!~/editSave/i) {
|
if($self->session->form->param("func")!~/editSave/i) {
|
||||||
$proxiedUrl = $self->session->form->process("FormAction") || $self->session->form->process("proxiedUrl") || $self->get("proxiedUrl") ;
|
$proxiedUrl = $self->session->form->process("FormAction") || $self->session->form->process("proxiedUrl") || $self->get("proxiedUrl") ;
|
||||||
|
|
@ -311,18 +311,17 @@ sub view {
|
||||||
my $contentType = 'application/x-www-form-urlencoded'; # default Content Type header
|
my $contentType = 'application/x-www-form-urlencoded'; # default Content Type header
|
||||||
|
|
||||||
# Create a %formdata hash to pass key/value pairs to the POST request
|
# Create a %formdata hash to pass key/value pairs to the POST request
|
||||||
foreach my $input_name ($self->session->form->param) {
|
foreach my $input_name ($self->session->request->param) {
|
||||||
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
$input_name =~ s/^HttpProxy_// or next;
|
||||||
$input_name =~ s/^HttpProxy_//;
|
|
||||||
|
|
||||||
my $uploadFile = $self->session->request->upload($self->session->form->process('HttpProxy_'.$input_name));
|
my (@upload) = grep{defined} $self->session->request->upload('HttpProxy_'.$input_name);
|
||||||
if(-r $uploadFile) { # Found uploaded file
|
if (@upload) { # Found uploaded file
|
||||||
@formUpload=($uploadFile, $self->session->form->process('HttpProxy_'.$input_name));
|
my $upload = $upload[0];
|
||||||
$formdata{$input_name}=\@formUpload;
|
$formdata{$input_name}=[$upload->tempname, $self->session->form->process('HttpProxy_'.$input_name)];
|
||||||
$contentType = 'form-data'; # Different Content Type header for file upload
|
$contentType = 'form-data'; # Different Content Type header for file upload
|
||||||
} else {
|
} else {
|
||||||
$formdata{$input_name}=$self->session->form->process('HttpProxy_'.$input_name);
|
$formdata{$input_name}=$self->session->form->process('HttpProxy_'.$input_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Create POST request
|
# Create POST request
|
||||||
$request = HTTP::Request::Common::POST($proxiedUrl, \%formdata, Content_Type => $contentType);
|
$request = HTTP::Request::Common::POST($proxiedUrl, \%formdata, Content_Type => $contentType);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue