|
|
@@ -33,7 +33,9 @@ module.exports = function(crowi, app) {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
+ debug(deliveryFile.fileName);
|
|
|
if (deliveryFile.fileName.match(/^\/uploads/)) {
|
|
|
+ debug('Using loacal file module, just redirecting.')
|
|
|
return res.redirect(deliveryFile.fileName);
|
|
|
} else {
|
|
|
return res.sendFile(deliveryFile.fileName, deliveryFile.options);
|
|
|
@@ -123,11 +125,19 @@ module.exports = function(crowi, app) {
|
|
|
// TODO size
|
|
|
return Attachment.create(id, req.user, filePath, originalName, fileName, fileType, fileSize);
|
|
|
}).then(function(data) {
|
|
|
- var imageUrl = fileUploader.generateUrl(data.filePath);
|
|
|
+ var fileUrl = data.fileUrl;
|
|
|
+ var config = crowi.getConfig();
|
|
|
+
|
|
|
+ // isLocalUrl??
|
|
|
+ if (!fileUrl.match(/^https?/)) {
|
|
|
+ fileUrl = (config.crowi['app:url'] || '') + fileUrl;
|
|
|
+ }
|
|
|
+
|
|
|
var result = {
|
|
|
page: page.toObject(),
|
|
|
attachment: data.toObject(),
|
|
|
- filename: imageUrl,
|
|
|
+ url: fileUrl,
|
|
|
+ filename: fileUrl, // this is for inline-attachemnets plugin http://inlineattachment.readthedocs.io/en/latest/pages/configuration.html
|
|
|
pageCreated: pageCreated,
|
|
|
};
|
|
|
|