GautamGupta / YOURLS-Import-Export

Import and Export YOURLS
GNU General Public License v3.0
49 stars 6 forks source link

Allowed character filter get_shorturl_charset ignored #17

Open RavanH opened 2 months ago

RavanH commented 2 months ago

Hi, we're using the following filter (via a plugin) to allow hyphens in keywords:

yourls_add_filter( 'get_shorturl_charset', 'ozh_hyphen_in_charset' );

function ozh_hyphen_in_charset( $in ) {
    return $in . '-';
}

This works fine when manually adding URLs via the admin, but on import from CSV all hyphens still get stripped.

Tried to find out where it goes wrong but as far as I can see, the call yourls_add_new_link( trim( $csv[1] ), $keyword ); in fileio/csv.php should (as far as I can tell) be using yourls_sanitize_keyword() which in turn uses the filter get_shorturl_charset. But apparently, I'm mistaken...

Any thoughts?