mirror of
https://github.com/nextcloud/passman.git
synced 2025-10-29 06:45:59 +08:00
Fix for downloading files (Firefox and chrome). Fixes #259
This commit is contained in:
parent
33d1a5db01
commit
ce35286664
3 changed files with 26 additions and 24 deletions
|
|
@ -409,27 +409,5 @@
|
|||
$scope.delete_time = 0;
|
||||
};
|
||||
|
||||
$scope.downloadFile = function (credential, file) {
|
||||
var callback = function (result) {
|
||||
var key = EncryptService.getSharedKeyFromCredential(credential);
|
||||
|
||||
if (!result.hasOwnProperty('file_data')) {
|
||||
NotificationService.showNotification($translate.instant('error.loading.file.perm'), 5000);
|
||||
return;
|
||||
|
||||
}
|
||||
var file_data = EncryptService.decryptString(result.file_data, key);
|
||||
download(file_data, escapeHTML(file.filename), file.mimetype);
|
||||
|
||||
};
|
||||
|
||||
if (!credential.hasOwnProperty('acl')) {
|
||||
FileService.getFile(file).then(callback);
|
||||
} else {
|
||||
ShareService.downloadSharedFile(credential, file).then(callback);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}]);
|
||||
}());
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
function countCredentials() {
|
||||
var countedCredentials = 0;
|
||||
var total = 0;
|
||||
if(!scope.vault.hasOwnProperty('credentials')){
|
||||
if(!scope.vault || !scope.vault.hasOwnProperty('credentials')){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@
|
|||
* # passwordGen
|
||||
*/
|
||||
angular.module('passmanApp')
|
||||
.directive('credentialTemplate', [function () {
|
||||
.directive('credentialTemplate', ['EncryptService', '$translate', 'FileService', 'ShareService', 'NotificationService', 'CredentialService',
|
||||
function (EncryptService, $translate, FileService, ShareService, NotificationService, CredentialService) {
|
||||
return {
|
||||
templateUrl: 'views/partials/credential_template.html',
|
||||
replace: true,
|
||||
|
|
@ -39,6 +40,29 @@
|
|||
},
|
||||
|
||||
link: function (scope, element, attrs) {
|
||||
scope.downloadFile = function (credential, file) {
|
||||
console.log('hi')
|
||||
var callback = function (result) {
|
||||
console.log(EncryptService);
|
||||
var key = CredentialService.getSharedKeyFromCredential(credential);
|
||||
if (!result.hasOwnProperty('file_data')) {
|
||||
NotificationService.showNotification($translate.instant('error.loading.file.perm'), 5000);
|
||||
return;
|
||||
|
||||
}
|
||||
var file_data = EncryptService.decryptString(result.file_data, key);
|
||||
download(file_data, escapeHTML(file.filename), file.mimetype);
|
||||
|
||||
};
|
||||
|
||||
if (!credential.hasOwnProperty('acl')) {
|
||||
FileService.getFile(file).then(callback);
|
||||
} else {
|
||||
ShareService.downloadSharedFile(credential, file).then(callback);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
scope.showLabel = (attrs.hasOwnProperty('showLabel'));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue