-
Notifications
You must be signed in to change notification settings - Fork 303
Allowing E-Document Attachments to be PDF #5311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Apps/W1/EDocument/App/src/Service/EDocumentService.Table.al
Outdated
Show resolved
Hide resolved
src/Apps/W1/EDocument/App/src/Service/EDocumentService.Table.al
Outdated
Show resolved
Hide resolved
src/Apps/W1/EDocument/App/src/Processing/EDocumentProcessing.Codeunit.al
Outdated
Show resolved
Hide resolved
|
Looks like we've got another codecop issue: Possible overflow assigning 'Text' to 'Text[4]'. |
@miljance the problem seems to be the parametere I would refactor this procedure, to only return a AttachmentFileNameWithExtension with a Max Length of 250 (This is the maximium length in the BaseApp). I had a similiar requirement in the past to trim a filename: // This shortens the filename but keeps the file extension.
procedure ShortenFileName(FileName: Text): Text[250]
var
FileManagement: Codeunit "File Management";
MaxFileNameWithoutExtensionLength: Integer;
Extension: Text;
FileNameWithoutExtension: Text;
FileNameWithFixedLength: Text[250];
begin
if StrLen(FileName) <= MaxStrLen(FileNameWithFixedLength) then begin
FileNameWithFixedLength := CopyStr(FileName, 1, MaxStrLen(FileNameWithFixedLength));
exit(FileNameWithFixedLength);
end;
FileNameWithoutExtension := FileManagement.GetFileNameWithoutExtension(FileName);
Extension := FileManagement.GetExtension(FileName);
MaxFileNameWithoutExtensionLength := MaxStrLen(FileNameWithFixedLength) - StrLen(Extension) - 1;
FileNameWithFixedLength := CopyStr(FileNameWithoutExtension, 1, MaxFileNameWithoutExtensionLength) + '.' + Extension;
exit(FileNameWithFixedLength);
end; |
cde3758 to
8062f05
Compare
8062f05 to
045a9c8
Compare
The overflow comes from using Text[4] for AttachmentFileExtension in CreateAttachmentsBlob. @djukicmilica or @JesperSchulz please let me know if you think it makes sense to deal with file name length limitation in the scope of this change. |
|
@miljance, let's keep focus and deal with the file name length limitation in a separate PR. Time to get this merged. |
Summary
Work Item(s)
Fixes #5220 and #5104
Fixes AB#611441