mirror of
https://github.com/wekan/wekan.git
synced 2025-04-24 22:17:16 -04:00
Attachment migration, add error logs
This commit is contained in:
parent
368fe24956
commit
47ca6829eb
2 changed files with 21 additions and 21 deletions
|
@ -26,7 +26,7 @@ export const createOnAfterUpload = bucket =>
|
|||
// and we unlink the file from the fs on any error
|
||||
// that occurred during the upload to prevent zombie files
|
||||
.on('error', err => {
|
||||
// console.error(err);
|
||||
console.error("[createOnAfterUpload error]", err);
|
||||
self.unlink(this.collection.findOne(file._id), versionName); // Unlink files from FS
|
||||
})
|
||||
|
||||
|
|
|
@ -1146,8 +1146,12 @@ Migrations.add('migrate-attachments-collectionFS-to-ostrioFiles', () => {
|
|||
const readStream = fileObj.createReadStream('attachments');
|
||||
const writeStream = fs.createWriteStream(filePath);
|
||||
|
||||
writeStream.on('error', function(err) {
|
||||
console.log('Writing error: ', err, filePath);
|
||||
writeStream.on('error', error => {
|
||||
console.error('[writeStream error]: ', error, filePath);
|
||||
});
|
||||
|
||||
readStream.on('error', error => {
|
||||
console.error('[readStream error]: ', error, filePath);
|
||||
});
|
||||
|
||||
// Once we have a file, then upload it to our new data storage
|
||||
|
@ -1171,11 +1175,11 @@ Migrations.add('migrate-attachments-collectionFS-to-ostrioFiles', () => {
|
|||
size: fileSize,
|
||||
fileId,
|
||||
},
|
||||
(err, fileRef) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
(error, fileRef) => {
|
||||
if (error) {
|
||||
console.error('[Attachments#addFile error]: ', error);
|
||||
} else {
|
||||
console.log('File Inserted: ', fileRef._id);
|
||||
console.log('File Inserted: ', fileRef);
|
||||
// Set the userId again
|
||||
Attachments.update({ _id: fileRef._id }, { $set: { userId } });
|
||||
fileObj.remove();
|
||||
|
@ -1185,10 +1189,6 @@ Migrations.add('migrate-attachments-collectionFS-to-ostrioFiles', () => {
|
|||
); // proceedAfterUpload
|
||||
});
|
||||
|
||||
readStream.on('error', error => {
|
||||
console.log('Error: ', filePath, error);
|
||||
});
|
||||
|
||||
readStream.pipe(writeStream);
|
||||
});
|
||||
});
|
||||
|
@ -1213,8 +1213,12 @@ Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
|
|||
const readStream = fileObj.createReadStream('avatars');
|
||||
const writeStream = fs.createWriteStream(filePath);
|
||||
|
||||
writeStream.on('error', function(err) {
|
||||
console.log('Writing error: ', err, filePath);
|
||||
writeStream.on('error', error => {
|
||||
console.error('[writeStream error]: ', error, filePath);
|
||||
});
|
||||
|
||||
readStream.on('error', error => {
|
||||
console.error('[readStream error]: ', error, filePath);
|
||||
});
|
||||
|
||||
// Once we have a file, then upload it to our new data storage
|
||||
|
@ -1237,11 +1241,11 @@ Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
|
|||
size: fileSize,
|
||||
fileId,
|
||||
},
|
||||
(err, fileRef) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
(error, fileRef) => {
|
||||
if (error) {
|
||||
console.error('[Avatars#addFile error]: ', error);
|
||||
} else {
|
||||
console.log('File Inserted: ', newFileName, fileRef._id);
|
||||
console.log('File Inserted: ', newFileName, fileRef);
|
||||
// Set the userId again
|
||||
Avatars.update({ _id: fileRef._id }, { $set: { userId } });
|
||||
Users.find().forEach(user => {
|
||||
|
@ -1267,10 +1271,6 @@ Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
|
|||
);
|
||||
});
|
||||
|
||||
readStream.on('error', error => {
|
||||
console.log('Error: ', filePath, error);
|
||||
});
|
||||
|
||||
readStream.pipe(writeStream);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue