Skip to content

Commit 28344c1

Browse files
committed
#801 updated filename replacement logic
1 parent 4b0bec5 commit 28344c1

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
@@ -195,7 +195,9 @@ export default class SPService implements ISPService {
195195
public async addAttachment(listId: string, itemId: number, fileName: string, file: File, webUrl?: string): Promise<void> {
196196
try {
197197
// Remove special characters in FileName
198-
fileName = fileName.replace(/[^\.\w\s\&\-]/gi, '');
198+
//Updating the escape characters for filename as per the doucmentations
199+
//https://support.microsoft.com/en-us/kb/905231
200+
fileName = fileName.replace(/[\~\#\%\&\*\{\}\\\:\<\>\?\/\+\|]/gi, '');
199201
// Check if attachment exists
200202
const fileExists = await this.checkAttachmentExists(listId, itemId, fileName, webUrl);
201203
// Delete attachment if it exists

0 commit comments

Comments
 (0)