Skip to content

Commit

Permalink
ZEPHYR-28941: url decoded attachment response file name before matching
Browse files Browse the repository at this point in the history
  • Loading branch information
pv-smartbear committed May 14, 2020
1 parent 771b5ac commit e54b0af
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -7,6 +7,7 @@

import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -93,7 +94,8 @@ private void addAttachments(List<GenericAttachmentDTO> genericAttachmentDTOList)
Attachment attachment = new Attachment();
attachment.setContentType(genericAttachmentDTO.getContentType());

GenericAttachmentDTO oldAttachment = genericAttachmentDTOList.stream().filter(attachmentDTO -> genericAttachmentDTO.getFileName().equals(attachmentDTO.getFileName())).findAny().orElse(null);
String createdFileName = URLDecoder.decode(genericAttachmentDTO.getFileName(), "UTF-8");
GenericAttachmentDTO oldAttachment = genericAttachmentDTOList.stream().filter(attachmentDTO -> createdFileName.equals(attachmentDTO.getFileName())).findAny().orElse(null);

if(oldAttachment != null) {
attachment.setFileSize((long)oldAttachment.getByteData().length);
Expand Down

0 comments on commit e54b0af

Please sign in to comment.