Rather than warn the user to input directory paths without trailing slashes, could DruTeX instead handle that automatically?

Comments

dfg’s picture

Assigned: Unassigned » dfg
Status: Active » Fixed

The problem was, DruTeX retrieves and uses paths at many many places. It couldn't be a solution to use rtrim() on every of these places.

A good solution would be to rtrim() the paths and urls before saving it. But since the settings page has its own submitting/validation functions, I cannot hook somehow inthere and influence how the paths are saved.

But I found another good solution:
Since DruTeX always uses drutex_var_get() to retrieve the paths and urls, I changed the function to automatically rtrim() the slashes of paths and urls. This are the settings that begin with 'drutex_dir' or 'drutex_url', like "drutex_dir_images_$format".

      if (strpos($ask, 'drutex_dir') === 0 || strpos($ask, 'drutex_url') === 0) {
        return rtrim($res, '/');
      }
      else {
        return $res;
      }

It works perfect.

Anonymous’s picture

Status: Fixed » Closed (fixed)