0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Complete subdir support.

fixes #527
- Fix image upload in backend
- Use config.paths().webroot where necessary
This commit is contained in:
Fabian Becker 2013-11-29 18:07:51 +00:00 committed by Hannah Wolfe
parent 9ec7e4ea38
commit c81c43a96a
2 changed files with 4 additions and 3 deletions

View file

@ -99,6 +99,7 @@ function activateTheme(activeTheme) {
expressServer.enable(expressServer.get('activeTheme'));
if (stackLocation) {
expressServer.stack[stackLocation].handle = middleware.whenEnabled(expressServer.get('activeTheme'), middleware.staticTheme());
expressServer.stack[stackLocation].route = config.paths().webroot;
}
// set view engine
@ -237,8 +238,8 @@ module.exports = function (server, dbHash) {
expressServer.use(express.json());
expressServer.use(express.urlencoded());
expressServer.use('/ghost/upload/', middleware.busboy);
expressServer.use('/ghost/api/v0.1/db/', middleware.busboy);
expressServer.use(root + '/ghost/upload/', middleware.busboy);
expressServer.use(root + '/ghost/api/v0.1/db/', middleware.busboy);
// Session handling
expressServer.use(express.cookieParser());

View file

@ -33,7 +33,7 @@ localFileStore = _.extend(baseStore, {
}).then(function () {
// The src for the image must be in URI format, not a file system path, which in Windows uses \
// For local file system storage can use relative path so add a slash
var fullUrl = ('/' + targetFilename).replace(new RegExp('\\' + path.sep, 'g'), '/');
var fullUrl = (config.paths().webroot + '/' + targetFilename).replace(new RegExp('\\' + path.sep, 'g'), '/');
return saved.resolve(fullUrl);
}).otherwise(function (e) {
errors.logError(e);