cakephp / api_generator

[Unmaintained] Official CakePHP API Generator Git Repository
113 stars 31 forks source link

Broken links at /api_generator/api_files/files #20

Open ghost opened 11 years ago

ghost commented 11 years ago

Created by Bancer, 13th Sep 2012. (originally Lighthouse ticket #94):


The method produces broken links on Windows public function fileLink($filename, $url = array(), $attributes = array()) { $url = array_merge($this->_defaultUrl['file'], $url); $trimmedFile = $this->trimFileName($filename); if (!empty($trimmedFile) && $trimmedFile != $filename) { $url = array_merge($url, explode('/', $trimmedFile)); return $this->Html->link($trimmedFile, $url, $attributes); } return $filename; }

Therefore it must to be corrected:

public function fileLink($filename, $url = array(), $attributes = array()) {
    $url = array_merge($this->_defaultUrl['file'], $url);
    $trimmedFile = $this->trimFileName($filename);
    if (!empty($trimmedFile) && $trimmedFile != $filename) {
        $url = array_merge($url, explode(DIRECTORY_SEPARATOR, $trimmedFile));
        return $this->Html->link($trimmedFile, $url, $attributes);
    }
    return $filename;
}
ghost commented 11 years ago

13th Sep 2012, Mark Story said:


If you could send your change as a github pull request I can get it merged in much faster. If not I'll get around to it.

ghost commented 11 years ago

13th Sep 2012, Bancer said:


Sorry, I can't do it fast. I am not 'friendly' with github yet :)

The only change is to replace '/' with DIRECTORY_SEPARATOR.

After I submitted the ticket I noticed that there is a similar one - http://cakephp.lighthouseapp.com/projects/42879/tickets/88-apidochelperfilelink-returns-wrong-url-on-operating-systems-that-use-as-ds. So, this change would fix that too, I believe.