Skip to content

Commit

Permalink
#801 updated filename replacement logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kunj-sangani authored and AJIXuMuK committed Apr 11, 2021
1 parent d5ea2e8 commit 370a1f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/services/SPService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ export default class SPService implements ISPService {
public async addAttachment(listId: string, itemId: number, fileName: string, file: File, webUrl?: string): Promise<void> {
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
Expand Down

0 comments on commit 370a1f0

Please sign in to comment.