Merge pull request #9753 from owncloud/filepath-css

Remove special case for css in OC.filePath
remotes/origin/fix-10825
Thomas Müller 10 years ago
commit fd92fc7c47
  1. 2
      core/js/js.js
  2. 20
      core/js/tests/specs/coreSpec.js

@ -260,7 +260,7 @@ var OC={
filePath:function(app,type,file){
var isCore=OC.coreApps.indexOf(app)!==-1,
link=OC.webroot;
if((file.substring(file.length-3) === 'php' || file.substring(file.length-3) === 'css') && !isCore){
if(file.substring(file.length-3) === 'php' && !isCore){
link+='/index.php/apps/' + app;
if (file != 'index.php') {
link+='/';

@ -134,6 +134,26 @@ describe('Core base tests', function() {
expect(escapeHTML('This is a good string without HTML.')).toEqual('This is a good string without HTML.');
});
});
describe('filePath', function() {
beforeEach(function() {
OC.webroot = 'http://localhost';
OC.appswebroots['files'] = OC.webroot + '/apps3/files';
});
afterEach(function() {
delete OC.appswebroots['files'];
});
it('Uses a direct link for css and images,' , function() {
expect(OC.filePath('core', 'css', 'style.css')).toEqual('http://localhost/core/css/style.css');
expect(OC.filePath('files', 'css', 'style.css')).toEqual('http://localhost/apps3/files/css/style.css');
expect(OC.filePath('core', 'img', 'image.png')).toEqual('http://localhost/core/img/image.png');
expect(OC.filePath('files', 'img', 'image.png')).toEqual('http://localhost/apps3/files/img/image.png');
});
it('Routes PHP files via index.php,' , function() {
expect(OC.filePath('core', 'ajax', 'test.php')).toEqual('http://localhost/index.php/core/ajax/test.php');
expect(OC.filePath('files', 'ajax', 'test.php')).toEqual('http://localhost/index.php/apps/files/ajax/test.php');
});
});
describe('Link functions', function() {
var TESTAPP = 'testapp';
var TESTAPP_ROOT = OC.webroot + '/appsx/testapp';

Loading…
Cancel
Save