Skip to content

Commit

Permalink
Merge pull request #873 from kunj-sangani/659
Browse files Browse the repository at this point in the history
#801 updated filename replacement logic
  • Loading branch information
AJIXuMuK committed Apr 11, 2021
2 parents 9132568 + 28344c1 commit bf57225
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 @@ -247,7 +247,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 bf57225

Please sign in to comment.