Search code examples
pyrocms

PyroStreams is adding an extra slash after 'files', before the image name in image urls?


PyroStreams is adding an extra slash into url's for some reason. The images display fine in all tested browsers, however my client is concerned. I've checked my .htaccess but I can't see where I would be causing this. This also happens within the streams interface, meaning I'm getting the extra slash in code I haven't touched.

This:

<img src="{{ hero:image }}" width="305" alt="">

Produces this:

<img src="http://rococ.co/grandhelo/pyroapp/site/uploads/default/files//ssvs-hero.jpg" width="305" alt="">

Here's the .htaccess for good measure:

# Multiple Environment config
# Set this to development, staging or production
# SetEnv PYRO_ENV production

<IfModule mod_rewrite.c>

# Make sure directory listing is disabled
Options +FollowSymLinks -Indexes
RewriteEngine on

# NOTICE: If you get a 404 play with combinations of the following commented out lines
#AllowOverride All
#RewriteBase /wherever/pyro/is

# Restrict your site to only one domain
# !important USE ONLY ONE OPTION

# Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines.
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#RewriteCond %{HTTP_HOST} (.+)$ [NC]
#RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

# Remove index.php from URL
RewriteCond %{HTTP:X-Requested-With}    !^XMLHttpRequest$
RewriteCond %{THE_REQUEST}              ^[^/]*/index\.php [NC]
RewriteRule ^index\.php(.*)$            $1 [R=301,NS,L]

# Keep people out of codeigniter directory and Git/Mercurial data
RedirectMatch 403 ^/(system\/cms\/cache|system\/codeigniter|\.git|\.hg).*$

# Send request via index.php (again, not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

<IfModule mod_php5.c>
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_php5.c>
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

</IfModule>

Does anyone know how to stop this behavior, or have any insight that I could pass on to my client explaining how this is not a problem?


Solution

  • There was a bug in the pyro_streams image filetype.

    adamfairholm posted a fix: https://github.com/pyrocms/pyrocms/commit/f96cf0ac356935faea466c626a6f6ba829dc6684

    304  304    
         {
    305  305    
           $image = $db_obj->row();
    306  306    
    
    307     
    -      $full = $this->CI->config->item('files:path') . '/' . $image->name;
         307    
    +      $full = $this->CI->config->item('files:path').$image->name;
    308  308    
    
    309  309    
           $image_data['filename']    = $image->name;
    310  310    
           $image_data['image']    = base_url().$full;
    ...  ...    
    @@ -322,8 +322,8 @@ public function pre_output_plugin($input, $params)
    322  322    
           if( file_exists( $path . '/'.$plain_name.'_thumb'.$image->extension ) )
    323  323    
           {
    324  324    
    
    325     
    -        $image_data['thumb']    = base_url().$this->CI->config->item('files:path') . '/' . $plain_name.'_thumb' . $image->extension;
    326     
    -        $image_data['thumb_img']  = img( array('alt'=>$image->name, 'src'=> $this->CI->config->item('files:path') . '/' . $plain_name.'_thumb' . $image->extension) );
         325    
    +        $image_data['thumb']    = base_url().$this->CI->config->item('files:path').$plain_name.'_thumb' . $image->extension;
         326    
    +        $image_data['thumb_img']  = img( array('alt'=>$image->name, 'src'=> $this->CI->config->item('files:path').$plain_name.'_thumb' . $image->extension) );
    327  327    
           }
    328  328    
           else
    329  329    
           {