Skip to content

Commit

Permalink
fix: img url on pages use "\" instead of "/" fixes #111 & fixes #152
Browse files Browse the repository at this point in the history
  • Loading branch information
wonknu committed Feb 17, 2017
1 parent 2349e0a commit 50a66a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cli/cms/media/image.js
Expand Up @@ -125,15 +125,21 @@ export function saveFile(req) {
fstream.on('finish', function() {
if(hasSentHeader) return

resp.filePath = (/^win/.test(process.platform)) ? resp.filePath.replace(/\\/g, '/').replace(/\/\//g, '/').replace(/\/$/, "") : resp.filePath;
resp = abeExtend.hooks.instance.trigger('afterSaveImage', resp, req)

if(mediaType === 'image') {
var thumbPromise = generateThumbnail(filePath)
thumbPromise.then(function (thumbResp) {
resp.thumbnail = thumbResp.thumb
resp.thumbnail = (/^win/.test(process.platform)) ? thumbResp.thumb.replace(/\\/g, '/') : thumbResp.thumb;
if(req.query.input.indexOf('data-size') > -1){
var thumbsSizes = cmsData.regex.getAttr(req.query.input, 'data-size').split(',')
cropAndSaveFiles(thumbsSizes, filePath, resp).then(function (resp) {
if(/^win/.test(process.platform)){
for (var i = 0; i < resp.thumbs.length; i++) {
resp.thumbs[i].name = resp.thumbs[i].name.replace(/\\/g, '/')
}
}
resolve(resp)
})
}
Expand Down

0 comments on commit 50a66a2

Please sign in to comment.