Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attachment: open image use an absolute link instead of a relative one #4724

Closed
rcubetrac opened this issue Dec 11, 2014 · 17 comments

Comments

Projects
None yet
2 participants
@rcubetrac
Copy link

commented Dec 11, 2014

Reported by bepi on 11 Dec 2014 13:13 UTC as Trac ticket #1490191

Hi,

I'm using roundcube through an http_proxy module of Apache 2. I noted a small problem when you press the link to view an attachment, it opens a new windows, inside the "iframe" there is the home page instead of the image (or PDF). If I choose to download the image or the pdf all is fine.
If I use roundcube directly (via ip) all is fine as usual :).

This is the iframe:

<roundcube:object name="messagePartFrame" id="messagepartframe" frameborder="0" />

Inspecting the code and the apaches logs, for me what miss is a DOT in the URL. All others urls are relative (they start with a dot) except this one that start wita a /

If possible can you fix the url?

Thank you,

best regards.

Migrated-From: http://trac.roundcube.net/ticket/1490191

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 11, 2014

Comment by bepi on 11 Dec 2014 13:18 UTC

I can't post or add as attachment the apache log, is marked as spam (the log is a list of link).

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 15, 2014

Comment by @alecpl on 15 Dec 2014 10:02 UTC

Works for me. The URL starts with ./?. The code is here https://github.com/roundcube/roundcubemail/blob/master/program/steps/mail/get.inc#L469. Did you try with disabled plugins?

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 15, 2014

Comment by bepi on 15 Dec 2014 16:59 UTC

Hi Alec,

#$config[= array('newmail_notifier', 'new_user_identity', 'jqueryui', 'managesieve', 'message_label', 'zipdownload', 'advanced_search' );
$config['plugins']('plugins']) = array();

no change also disabling the plugins.

I'll try do add log as image and an image of the output.

Thank you :)

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 18, 2014

Comment by @thomascube on 18 Dec 2014 12:28 UTC

I guess the problem is more in https://github.com/roundcube/roundcubemail/blob/master/program/steps/mail/get.inc#L23 where the iframe location is changed based on $_SERVER['REQUEST_URI'] which might be invalid in your setup. But it works for me.

Could you add a var_dump($_SERVER); exit; on line 27 in program/steps/mail/get.inc and investigate the environment variables you see in your the proxy setup?

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 18, 2014

Comment by bepi on 18 Dec 2014 13:38 UTC

Hi Thomas,

this one is fine

[string(128) "https://webmail.test.com/roundcube/?_task=mail&_framed=1&_action=get&_mbox=INBOX.Trash&_uid=44442&_part=2&_frame=1&_extwin=1"

this is absolute

["REQUEST_URI"]("HTTP_REFERER"]=>)=> string(92) "/?_task=mail&_framed=1&_action=get&_mbox=INBOX.Trash&_uid=44442&_part=2&_preload=1&_extwin=1"

The preview image has a relative link and it is displayed

<img class="image-thumbnail" src="./?_task=mail&amp;_action=get&amp;_mbox=INBOX.Trash&amp;_uid=44442&amp;_part=2&amp;_embed=1&amp;_mimeclass=image&amp;_thumb=1" title="IMG_20141214_100535.jpg" alt="IMG_20141214_100535.jpg" style="max-width:240px; max-height:240px">

Thank you :)

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 18, 2014

Comment by @thomascube on 18 Dec 2014 14:42 UTC

Replying to bepi:

this is absolute

["REQUEST_URI"]=> string(92) "/?_task=mail&_framed=1&_action=get&_mbox=INBOX.Trash&_uid=44442&_part=2&_preload=1&_extwin=1"

Then it's your Apache which messes up the environment. Unfortunately there's little we can do on the Roundcube side if we cannot rely on the environment variables we get from the web server.

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 18, 2014

Comment by bepi on 18 Dec 2014 15:04 UTC

Thomas,

https://github.com/roundcube/roundcubemail/blob/master/program/steps/mail/get.inc#L30

if I put a DOT after the = the image is showed as expected

. '<meta http-equiv="refresh" content="0; url=.'.rcube::Q($url).'">' . "\n"
@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 18, 2014

Comment by @alecpl on 18 Dec 2014 18:37 UTC

Thomas, maybe we should/could use QUERY_STRING here? Then it would be a relative path.

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 20, 2014

Comment by @thomascube on 20 Dec 2014 12:56 UTC

Replying to alec:

Thomas, maybe we should/could use QUERY_STRING here? Then it would be a relative path.

That could resolve this particular issue. But please note that there are several other places where we rely on REQUEST_URI. This is IMO something that should be fixed on a webserver configuration level.

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 27, 2014

Comment by @thomascube on 27 Dec 2014 14:13 UTC

Replying to bepi:

if I put a DOT after the = the image is showed as expected

This unfortunately only fixes your setup but would break all other installations where REQUEST_URI holds the correct value.

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Dec 27, 2014

Comment by @thomascube on 27 Dec 2014 14:16 UTC

Replying to alec:

Thomas, maybe we should/could use QUERY_STRING here? Then it would be a relative path.

The best option would probably be to use $RCMAIL->url($_GET) and make sure rcmail::url() yields the correct results.

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Feb 6, 2015

Comment by @alecpl on 6 Feb 2015 08:56 UTC

rcmail::url() depends on $_SERVER[(or $_SERVER'REDIRECT_SCRIPT_URL'). I'm curious if these are correct on @bepi's server. If not, this is just wontfix.

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Feb 6, 2015

Comment by bepi on 6 Feb 2015 09:56 UTC

Hi Alec,

I have this:

  ["SCRIPT_NAME"]=>
  string(20) "/roundcube/index.php"

I don't have REDIRECT_SCRIPT_URL in my $_SERVER

Thank you,

best regards.

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Mar 12, 2015

Status changed by @thomascube on 12 Mar 2015 15:25 UTC

new => assigned

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Mar 12, 2015

Owner changed by @thomascube on 12 Mar 2015 15:25 UTC

=> thomasb

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Mar 12, 2015

Comment by @thomascube on 12 Mar 2015 15:31 UTC

Fixed in commit [backported in c14c214(b1d13e8],)

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Mar 12, 2015

Status changed by @thomascube on 12 Mar 2015 15:31 UTC

assigned => closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.