Skip to content
This repository has been archived by the owner on Nov 7, 2020. It is now read-only.

Broken links at /api_generator/api_files/files #20

Open
ghost opened this issue Oct 11, 2013 · 2 comments
Open

Broken links at /api_generator/api_files/files #20

ghost opened this issue Oct 11, 2013 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 11, 2013

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
Copy link
Author

ghost commented Oct 11, 2013

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
Copy link
Author

ghost commented Oct 11, 2013

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

0 participants