fix(backup): download file link url issues

This commit is contained in:
OldHawk
2017-10-31 17:45:23 +08:00
parent 5e9449ebd8
commit e536f4c4bd
4 changed files with 10 additions and 4 deletions

View File

@@ -31,7 +31,6 @@ module.exports = {
backup: {
enable: true,
dir: './modules/backup/client/backup/'
},
/**

View File

@@ -14,6 +14,7 @@
vm.user = Authentication.user;
vm.DLS = DownloadService;
vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage;
vm.backupConfig = MeanTorrentConfig.meanTorrentConfig.backup;
vm.deleteList = [];
@@ -67,6 +68,8 @@
mtDebug.info(items);
vm.buildPager();
});
mtDebug.info(vm.backupConfig.dir);
};
/**

View File

@@ -30,7 +30,8 @@
<tbody>
<tr class="message-item" ng-repeat="f in vm.pagedItems">
<td class="td-v-middle">
<a href="/backup/download/{{f.name}}"
<a href="{{vm.backupConfig.dir.substr(1)}}{{f.name}}"
target="_self"
ng-click="vm.DLS.downloadBackupFile(f.name); $event.preventDefault(); $event.stopPropagation();">{{f.name}}</a>
</td>
<td class="td-v-middle text-center">

View File

@@ -330,8 +330,11 @@ exports.postNewTopic = function (req, res) {
});
//replace content path
var regex = new RegExp('/modules/forums/client/attach/temp/', 'g');
topic.content = topic.content.replace(regex, '/modules/forums/client/attach/');
var tmp = config.uploads.attach.file.temp.substr(1);
var dst = config.uploads.attach.file.dest.substr(1);
var regex = new RegExp(tmp, 'g');
topic.content = topic.content.replace(regex, dst);
//save topic
topic.save(function (err) {