Merge pull request #2845 from dpalou/MOBILE-3320
MOBILE-3320 files: Fix clearTmpFiles deleting files that shouldn't bemain
commit
4c4d67bd1d
|
@ -19,7 +19,7 @@ import { MediaFile, CaptureError, CaptureAudioOptions, CaptureVideoOptions } fro
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
import { CoreApp } from '@services/app';
|
import { CoreApp } from '@services/app';
|
||||||
import { CoreFile } from '@services/file';
|
import { CoreFile, CoreFileProvider } from '@services/file';
|
||||||
import { CoreFilepool } from '@services/filepool';
|
import { CoreFilepool } from '@services/filepool';
|
||||||
import { CoreSites } from '@services/sites';
|
import { CoreSites } from '@services/sites';
|
||||||
import { CoreMimetypeUtils } from '@services/utils/mimetype';
|
import { CoreMimetypeUtils } from '@services/utils/mimetype';
|
||||||
|
@ -191,14 +191,14 @@ export class CoreFileUploaderProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear temporary attachments to be uploaded.
|
* Clear temporary attachments to be uploaded.
|
||||||
* Attachments already saved in an offline store will NOT be deleted.
|
* Attachments already saved in an offline store will NOT be deleted, only files in tmp folder will be deleted.
|
||||||
*
|
*
|
||||||
* @param files List of files.
|
* @param files List of files.
|
||||||
*/
|
*/
|
||||||
clearTmpFiles(files: (CoreWSFile | FileEntry)[]): void {
|
clearTmpFiles(files: (CoreWSFile | FileEntry)[]): void {
|
||||||
// Delete the local files.
|
// Delete the temporary files.
|
||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
if ('remove' in file) {
|
if ('remove' in file && CoreFile.removeBasePath(file.toURL()).startsWith(CoreFileProvider.TMPFOLDER)) {
|
||||||
// Pass an empty function to prevent missing parameter error.
|
// Pass an empty function to prevent missing parameter error.
|
||||||
file.remove(() => {
|
file.remove(() => {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
|
|
Loading…
Reference in New Issue