diff --git a/src/services/SPService.ts b/src/services/SPService.ts index ac193bd43..85d555aae 100644 --- a/src/services/SPService.ts +++ b/src/services/SPService.ts @@ -247,7 +247,9 @@ export default class SPService implements ISPService { public async addAttachment(listId: string, itemId: number, fileName: string, file: File, webUrl?: string): Promise { try { // Remove special characters in FileName - fileName = fileName.replace(/[^\.\w\s\&\-]/gi, ''); + //Updating the escape characters for filename as per the doucmentations + //https://support.microsoft.com/en-us/kb/905231 + fileName = fileName.replace(/[\~\#\%\&\*\{\}\\\:\<\>\?\/\+\|]/gi, ''); // Check if attachment exists const fileExists = await this.checkAttachmentExists(listId, itemId, fileName, webUrl); // Delete attachment if it exists