diff options
| author | Vincent Richard <[email protected]> | 2013-11-23 08:25:38 +0000 |
|---|---|---|
| committer | Vincent Richard <[email protected]> | 2013-11-23 08:25:38 +0000 |
| commit | 7aebeeb2e2ad13c89c202d0bfa8c634ab27b91b4 (patch) | |
| tree | 591c6558daf2773bb0ce913e39189b295d9406c9 /src/bodyPartAttachment.cpp | |
| parent | Do not throw exception for normal code flow (exceptions::no_such_field). (diff) | |
| download | vmime-7aebeeb2e2ad13c89c202d0bfa8c634ab27b91b4.tar.gz vmime-7aebeeb2e2ad13c89c202d0bfa8c634ab27b91b4.zip | |
Do not throw exception for normal code flow (exceptions::no_such_parameter).
Diffstat (limited to 'src/bodyPartAttachment.cpp')
| -rw-r--r-- | src/bodyPartAttachment.cpp | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/src/bodyPartAttachment.cpp b/src/bodyPartAttachment.cpp index 7b9adf01..0684a896 100644 --- a/src/bodyPartAttachment.cpp +++ b/src/bodyPartAttachment.cpp @@ -58,44 +58,21 @@ const word bodyPartAttachment::getName() const // Try the 'filename' parameter of 'Content-Disposition' field shared_ptr <const contentDispositionField> cdf = getContentDisposition(); - if (cdf) + if (cdf && cdf->hasFilename()) { - try - { - name = cdf->getFilename(); - } - catch (exceptions::no_such_parameter&) - { - // No 'filename' parameter - } + name = cdf->getFilename(); } - else - { - // No 'Content-Disposition' field - } - // Try the 'name' parameter of 'Content-Type' field - if (name.getBuffer().empty()) + else { shared_ptr <const contentTypeField> ctf = getContentType(); if (ctf) { - try - { - shared_ptr <const parameter> prm = ctf->findParameter("name"); + shared_ptr <const parameter> prm = ctf->findParameter("name"); - if (prm != NULL) - name = prm->getValue(); - } - catch (exceptions::no_such_parameter&) - { - // No attachment name available - } - } - else - { - // No 'Content-Type' field + if (prm != NULL) + name = prm->getValue(); } } |
