Mailing List Archive

Upload media file includes path info in IE.
Hi all,

We just upgraded our CMS from 1.10.6 to 2.0.1.

When we upload media file, it keeps including the file path as it's url
instead of the filename only (see attached). This only occurs in IE. Firefox
and Chrome are OK. Does anyone experience this and resolve it? This thing
did not occur when we use 1.10.6 with IE.

Regards,

Keith
Re: Upload media file includes path info in IE. [ In reply to ]
On Sep 26, 2011, at 8:05 PM, Keith Phua wrote:

> We just upgraded our CMS from 1.10.6 to 2.0.1.

\o/

> When we upload media file, it keeps including the file path as it's url instead of the filename only (see attached). This only occurs in IE. Firefox and Chrome are OK. Does anyone experience this and resolve it? This thing did not occur when we use 1.10.6 with IE.

Bah! IE is so hateful. I don't know why it would be starting again. Anyone got a copy of IE who can troubleshoot this? It sounds like a bug. This is the code that should fix IE's stupidity, though I don't' think it's changed since 1.10.

https://github.com/bricoleurs/bricolage/blob/master/lib/Bric/App/Callback/Profile/Media.pm#L868

Maybe the agent doesn't match "windows" or "msie" anymore for some reason?

Best,

David
Re: Upload media file includes path info in IE. [ In reply to ]
FYI, I am running 2.0.1 on mod_perl-2.0.4 and httpd-2.2.3. Not sure if this
help.

I am not that good with perl. How do I add a line to throw out
$ENV(HTTP_USER_AGENT) to the log so that I know what is coming out from this
variable.

Thanks.

Keith

On Tue, Sep 27, 2011 at 1:58 PM, David E. Wheeler <david@kineticode.com>wrote:

> On Sep 26, 2011, at 8:05 PM, Keith Phua wrote:
>
> > We just upgraded our CMS from 1.10.6 to 2.0.1.
>
> \o/
>
> > When we upload media file, it keeps including the file path as it's url
> instead of the filename only (see attached). This only occurs in IE. Firefox
> and Chrome are OK. Does anyone experience this and resolve it? This thing
> did not occur when we use 1.10.6 with IE.
>
> Bah! IE is so hateful. I don't know why it would be starting again. Anyone
> got a copy of IE who can troubleshoot this? It sounds like a bug. This is
> the code that should fix IE's stupidity, though I don't' think it's changed
> since 1.10.
>
>
> https://github.com/bricoleurs/bricolage/blob/master/lib/Bric/App/Callback/Profile/Media.pm#L868
>
> Maybe the agent doesn't match "windows" or "msie" anymore for some reason?
>
> Best,
>
> David
>
>
Re: Upload media file includes path info in IE. [ In reply to ]
Keith,

A few of our users have managed to encounter this issue in the past few
months, but I have never been able to reproduce it. What version of IE
are you using? Any plugins, toolbars, etc? Are you in compatibility
mode or anything like that?

-Nick

On 9/26/2011 11:05 PM, Keith Phua wrote:
> Hi all,
>
> We just upgraded our CMS from 1.10.6 to 2.0.1.
>
> When we upload media file, it keeps including the file path as it's
> url instead of the filename only (see attached). This only occurs in
> IE. Firefox and Chrome are OK. Does anyone experience this and
> resolve it? This thing did not occur when we use 1.10.6 with IE.
>
> Regards,
>
> Keith
Re: Upload media file includes path info in IE. [ In reply to ]
On 27 September 2011 12:42, Nick Legg <leggn@denison.edu> wrote:

> Keith,
>
> A few of our users have managed to encounter this issue in the past few
> months, but I have never been able to reproduce it. What version of IE are
> you using? Any plugins, toolbars, etc? Are you in compatibility mode or
> anything like that?
>
> -Nick
>
> On 9/26/2011 11:05 PM, Keith Phua wrote:
>
>> Hi all,
>>
>> We just upgraded our CMS from 1.10.6 to 2.0.1.
>>
>> When we upload media file, it keeps including the file path as it's url
>> instead of the filename only (see attached). This only occurs in IE. Firefox
>> and Chrome are OK. Does anyone experience this and resolve it? This thing
>> did not occur when we use 1.10.6 with IE.
>>
>>
>>
Instead of testing for the user_agent, could we not just check that the
file_path looks like it's windows e.g.:

my $filename = $upload->filename =~ /^\w\:\\/i

? Bric::Util::Trans::FS->base_name($upload->filename, 'win32')
: $upload->filename;



Adeola
Re: Upload media file includes path info in IE. [ In reply to ]
On Sep 27, 2011, at 12:24 AM, Keith Phua wrote:

> I am not that good with perl. How do I add a line to throw out
> $ENV(HTTP_USER_AGENT) to the log so that I know what is coming out from this
> variable.

print STDERR $ENV{HTTP_USER_AGENT}, $/;

Best,

David
Re: Upload media file includes path info in IE. [ In reply to ]
On Sep 27, 2011, at 5:34 AM, Adeola Awoyemi wrote:

> Instead of testing for the user_agent, could we not just check that the
> file_path looks like it's windows e.g.:
>
> my $filename = $upload->filename =~ /^\w\:\\/i
>
> ? Bric::Util::Trans::FS->base_name($upload->filename, 'win32')
> : $upload->filename;

Oh, does it always start with /[A-Z]:\\/? Yeah, that might be better.

Best,

David
RE: Upload media file includes path info in IE. [ In reply to ]
What if the file is uploaded from another machine? Something like \\otherserver\filesilike\picture.bmp?
I know that if I try to grab something from the web, it is downloaded as a local file and uploaded from there, but I would think network paths would upload directly from that location and completely escape either of the regex below.

Adam

-----Original Message-----
From: users@lists.bricolagecms.org [mailto:users@lists.bricolagecms.org] On Behalf Of David E. Wheeler
Sent: Tuesday, September 27, 2011 12:21 PM
To: users@lists.bricolagecms.org
Subject: Re: Upload media file includes path info in IE.

On Sep 27, 2011, at 5:34 AM, Adeola Awoyemi wrote:

> Instead of testing for the user_agent, could we not just check that
> the file_path looks like it's windows e.g.:
>
> my $filename = $upload->filename =~ /^\w\:\\/i
>
> ? Bric::Util::Trans::FS->base_name($upload->filename, 'win32')
> : $upload->filename;

Oh, does it always start with /[A-Z]:\\/? Yeah, that might be better.

Best,

David
Re: Upload media file includes path info in IE. [ In reply to ]
On Sep 27, 2011, at 10:09 AM, Adam Wilson wrote:

> What if the file is uploaded from another machine? Something like \\otherserver\filesilike\picture.bmp?
> I know that if I try to grab something from the web, it is downloaded as a local file and uploaded from there, but I would think network paths would upload directly from that location and completely escape either of the regex below.

I don't know; I don't us Windows. But if you all figure something out and send a pull request, I'll be happy to merge it (into all current branches).

Best,

David
Re: Upload media file includes path info in IE. [ In reply to ]
Hi All,

Thanks for all your help. I m not sure if it's a bug but I managed to
resolve it.

When I print out ENV{HTTP_USER_AGENT}, it throw out nothing!!. So I guess
the %ENV are not passed to mod_perl. So I take a look at ApacheConfig.pm
and discover that under modperl 2 section, SetHandler is set to 'modperl'.
Under mod perl2 documentation, set handler mod perl will not populate %ENV
to gain performance. So I reset the handler to 'perl-script' and it work as
before.

Once again, many thanks.

Regards,

Keith

On Wed, Sep 28, 2011 at 1:35 AM, David E. Wheeler <david@kineticode.com>wrote:

> On Sep 27, 2011, at 10:09 AM, Adam Wilson wrote:
>
> > What if the file is uploaded from another machine? Something like
> \\otherserver\filesilike\picture.bmp?
> > I know that if I try to grab something from the web, it is
> downloaded as a local file and uploaded from there, but I would think
> network paths would upload directly from that location and completely escape
> either of the regex below.
>
> I don't know; I don't us Windows. But if you all figure something out and
> send a pull request, I'll be happy to merge it (into all current branches).
>
> Best,
>
> David
>
>
Re: Upload media file includes path info in IE. [ In reply to ]
Im using :

if ($up->filename =~ /\\/) {
fileparse_set_fstype("MSDOS");
} else {
fileparse_set_fstype("UNIX");
}

my ($fname, $p, $ext) = fileparse($up->filename, $allowed);

and it works since years. fileparse comes from File::Basename , same as Bric::Util::Trans::FS->base_name does.



Am 27.09.2011 um 18:20 schrieb David E. Wheeler:

> On Sep 27, 2011, at 5:34 AM, Adeola Awoyemi wrote:
>
>> Instead of testing for the user_agent, could we not just check that the
>> file_path looks like it's windows e.g.:
>>
>> my $filename = $upload->filename =~ /^\w\:\\/i
>>
>> ? Bric::Util::Trans::FS->base_name($upload->filename, 'win32')
>> : $upload->filename;
>
> Oh, does it always start with /[A-Z]:\\/? Yeah, that might be better.
>
> Best,
>
> David
>


Rolf Schaufelberger
Re: Upload media file includes path info in IE. [ In reply to ]
Just to clarify my solution in case somebody has the same problem as me :)

Under Bric::App::ApacheConfig: Look at ### mod_perl 2 ## section.

Change:

my @config = { .....
' .....',
' Set Handler perl-script', ### originally set to 'modperl'
' ....',
};

Regards,

Keith



On Wed, Sep 28, 2011 at 9:38 AM, Keith Phua <keith.phua@gmail.com> wrote:

> Hi All,
>
> Thanks for all your help. I m not sure if it's a bug but I managed to
> resolve it.
>
> When I print out ENV{HTTP_USER_AGENT}, it throw out nothing!!. So I guess
> the %ENV are not passed to mod_perl. So I take a look at ApacheConfig.pm
> and discover that under modperl 2 section, SetHandler is set to 'modperl'.
> Under mod perl2 documentation, set handler mod perl will not populate %ENV
> to gain performance. So I reset the handler to 'perl-script' and it work as
> before.
>
> Once again, many thanks.
>
> Regards,
>
> Keith
>
> On Wed, Sep 28, 2011 at 1:35 AM, David E. Wheeler <david@kineticode.com>wrote:
>
>> On Sep 27, 2011, at 10:09 AM, Adam Wilson wrote:
>>
>> > What if the file is uploaded from another machine? Something like
>> \\otherserver\filesilike\picture.bmp?
>> > I know that if I try to grab something from the web, it is
>> downloaded as a local file and uploaded from there, but I would think
>> network paths would upload directly from that location and completely escape
>> either of the regex below.
>>
>> I don't know; I don't us Windows. But if you all figure something out and
>> send a pull request, I'll be happy to merge it (into all current branches).
>>
>> Best,
>>
>> David
>>
>>
>
Re: Upload media file includes path info in IE. [ In reply to ]
On Sep 28, 2011, at 2:41 AM, Rolf Schaufelberger wrote:

> if ($up->filename =~ /\\/) {
> fileparse_set_fstype("MSDOS");
> } else {
> fileparse_set_fstype("UNIX");
> }
>
> my ($fname, $p, $ext) = fileparse($up->filename, $allowed);
>
> and it works since years. fileparse comes from File::Basename , same as Bric::Util::Trans::FS->base_name does.

I'd welcome a patch to switch to something like this. I think we should avoid using the HTTP environment variables, so that we don't have to enable them like Keith discovered was necessary.

Best,

David