Skip to content

Commit 370a1f0

Browse files
kunj-sanganiAJIXuMuK
authored andcommitted
#801 updated filename replacement logic
1 parent d5ea2e8 commit 370a1f0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/services/SPService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ export default class SPService implements ISPService {
246246
public async addAttachment(listId: string, itemId: number, fileName: string, file: File, webUrl?: string): Promise<void> {
247247
try {
248248
// Remove special characters in FileName
249-
fileName = fileName.replace(/[^\.\w\s\&\-]/gi, '');
249+
//Updating the escape characters for filename as per the doucmentations
250+
//https://support.microsoft.com/en-us/kb/905231
251+
fileName = fileName.replace(/[\~\#\%\&\*\{\}\\\:\<\>\?\/\+\|]/gi, '');
250252
// Check if attachment exists
251253
const fileExists = await this.checkAttachmentExists(listId, itemId, fileName, webUrl);
252254
// Delete attachment if it exists

0 commit comments

Comments
 (0)