Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/private/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ public function match($url) {
}
}

/**
* Determine if the match can be made to a specific URL
*
* @param string $url The url to find
* @returns boolean True if the URL matches a route
*/
public function canMatch($url) {
$matcher = new UrlMatcher($this->root, $this->context);
return ($matcher->match($url)) ? true : false;
}

/**
* Get the url generator
*
Expand Down
8 changes: 8 additions & 0 deletions lib/private/template/jsresourcelocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public function doFind( $script ) {
) {
return;
}
if (\OC::getRouter()->canMatch($app_url . '/' . $script . $this->form_factor . '.js')) {
$this->append($app_path, $script . $this->form_factor . '.js', $_SERVER['SCRIPT_NAME'] . $app_url);
return;
}
if (\OC::getRouter()->canMatch($app_url . '/' . $script . '.js')) {
$this->append($app_path, $script . '.js', $_SERVER['SCRIPT_NAME'] . $app_url);
return;
}
throw new \Exception('js file not found: script:'.$script);
}

Expand Down
21 changes: 16 additions & 5 deletions lib/private/template/resourcelocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,26 @@ public function find( $resources ) {
*/
protected function appendIfExist($root, $file, $webroot = null) {
if (is_file($root.'/'.$file)) {
if (!$webroot) {
$webroot = $this->mapping[$root];
}
$this->resources[] = array($root, $webroot, $file);
return true;
return $this->append($root, $file, $webroot);
}
return false;
}

/*
* Append the $file resource at $root
* @param $root path to check
* @param $file the filename
* @param $web base for path, default map $root to $webroot
* @return boolean Always true
*/
protected function append($root, $file, $webroot = null) {
if (!$webroot) {
$webroot = $this->mapping[$root];
}
$this->resources[] = array($root, $webroot, $file);
return true;
}

public function getResources() {
return $this->resources;
}
Expand Down