CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#11831] Filepicker profile path issue when root_url defined in config

avatar
Created By: Matt Hornsby (DIGI3) (DIGI3)
Date Submitted: Tue Jun 05 12:39:48 -0400 2018

Assigned To:
Version: 2.2.7
CMSMS Version: 2.2.7
Severity: None
Resolution: Accepted
State: Open
Summary:
Filepicker profile path issue when root_url defined in config
Detailed Description:
Issue:
When you have a config.php entry defining a root_url, and a default filepicker
profile with an empty path (meaning you want it to be /uploads), images added
via wysiwyg will have broken paths.

To recreate:
Add a config.php entry, e.g .$config['root_url'] = 'https://mysite.com/'
Create a FilePicker profile, leaving the Top Directory empty
Set this profile to default
Clear cache
Edit a content page with WYSIWYG (I tested with MicroTiny)
Add an image
Submit
View page on frontend, and/or reopen page in Content Manager
path to image will be something like https://uploads/image.jpg

Expected behaviour:
path to image should be either /uploads/image.jpg or
https://mysite.com/uploads/image.jpg

Workarounds:
Define a top level path in FilePicker that is a directory within Uploads
OR, don't define root_url in config.php
Then clear cache and try again


History

Comments
avatar
Date: 2018-08-25 11:31
Posted By: Robert Campbell (calguy1000)

I have verified this, but it doesn't look like a FilePicker issue... it's some
wierdness in tinymce I think.
      
avatar
Date: 2020-06-23 13:14
Posted By: Ruud van der Velden (ruudvdvelden)

** CMSMS 2.2.14 **

During some tests it occurred to us that a default profile with empty Top
Directory caused a double // after uploads.
Temporary workaround is using a single dot for the Top directory.

Possible fix (should be tested):

modules\FilePicker\action.filepicker.php

Starting at line 62

$useprefix = cms_to_bool(get_parameter_value($_GET,'useprefix'));
if( $useprefix ) {
    $prefix = $profile->reltop;
    $profile = $profile->overrideWith( [ 'prefix'=>$prefix.'/' ] );
}

Consider changing to:

$useprefix = cms_to_bool(get_parameter_value($_GET,'useprefix'));
if( $useprefix ) {
    $prefix = $profile->reltop;
if (!empty($prefix)) $profile = $profile->overrideWith( [ 'prefix'=>$prefix.'/'
] );
}
      
Updates

Updated: 2018-08-25 11:31
resolution_id: => 6