aboutsummaryrefslogtreecommitdiffstats
path: root/src/bodyPartAttachment.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/bodyPartAttachment.cpp37
1 files changed, 7 insertions, 30 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
- }
- }
- else
- {
- // No 'Content-Disposition' field
+ name = cdf->getFilename();
}
-
// 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");
-
- if (prm != NULL)
- name = prm->getValue();
- }
- catch (exceptions::no_such_parameter&)
- {
- // No attachment name available
- }
- }
- else
- {
- // No 'Content-Type' field
+ shared_ptr <const parameter> prm = ctf->findParameter("name");
+
+ if (prm != NULL)
+ name = prm->getValue();
}
}