Skip to content

Commit bf57225

Browse files
authored
Merge pull request #873 from kunj-sangani/659
#801 updated filename replacement logic
2 parents 9132568 + 28344c1 commit bf57225

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

0 commit comments

Comments
 (0)