summaryrefslogtreecommitdiffstats
path: root/lib/Utils/make_descr.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-19 13:26:08 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-19 13:26:08 +0100
commitc3afe7c8ea7ccb147e30ccbafbfcdad279d479aa (patch)
tree94c39a5d2f45cee562c0529e2ffa22e22a369d8b /lib/Utils/make_descr.cpp
parent483f24b17ccfa0aaab8dd9d50b3228475d259bcf (diff)
downloadabrt-c3afe7c8ea7ccb147e30ccbafbfcdad279d479aa.tar.gz
abrt-c3afe7c8ea7ccb147e30ccbafbfcdad279d479aa.tar.xz
abrt-c3afe7c8ea7ccb147e30ccbafbfcdad279d479aa.zip
make BZ insert small text attachments inline; move text file detection code
Run-tested Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils/make_descr.cpp')
-rw-r--r--lib/Utils/make_descr.cpp38
1 files changed, 23 insertions, 15 deletions
diff --git a/lib/Utils/make_descr.cpp b/lib/Utils/make_descr.cpp
index 46dd48c8..c4cc3f35 100644
--- a/lib/Utils/make_descr.cpp
+++ b/lib/Utils/make_descr.cpp
@@ -51,6 +51,9 @@ static void add_content(bool &was_multiline, string& description, const char *he
}
}
+/* Text attachments smaller than this will be also included in descrition */
+#define INLINE_TEXT_ATT_SIZE 1024
+
string make_description_bz(const map_crash_report_t& pCrashReport)
{
string description;
@@ -77,8 +80,9 @@ string make_description_bz(const map_crash_report_t& pCrashReport)
const string &filename = it->first;
const string &type = it->second[CD_TYPE];
const string &content = it->second[CD_CONTENT];
- if (type == CD_TXT)
- {
+ if (type == CD_TXT
+ || (type == CD_ATT && content.size() < INLINE_TEXT_ATT_SIZE)
+ ) {
if (filename != CD_UUID
&& filename != FILENAME_ARCHITECTURE
&& filename != FILENAME_RELEASE
@@ -87,8 +91,9 @@ string make_description_bz(const map_crash_report_t& pCrashReport)
) {
add_content(was_multiline, description, filename.c_str(), content.c_str());
}
+ continue;
}
- else if (type == CD_ATT)
+ if (type == CD_ATT)
{
add_content(was_multiline, description, "Attached file", filename.c_str());
}
@@ -172,31 +177,34 @@ string make_description_catcut(const map_crash_report_t& pCrashReport)
for (it = pCrashReport.begin(); it != end; it++)
{
- if (it->second[CD_TYPE] == CD_TXT)
+ const string &filename = it->first;
+ const string &type = it->second[CD_TYPE];
+ const string &content = it->second[CD_CONTENT];
+ if (type == CD_TXT)
{
- if (it->first != CD_UUID
- && it->first != FILENAME_ARCHITECTURE
- && it->first != FILENAME_RELEASE
- && it->first != CD_REPRODUCE
- && it->first != CD_COMMENT
+ if (filename != CD_UUID
+ && filename != FILENAME_ARCHITECTURE
+ && filename != FILENAME_RELEASE
+ && filename != CD_REPRODUCE
+ && filename != CD_COMMENT
) {
pDescription += '\n';
- pDescription += it->first;
+ pDescription += filename;
pDescription += "\n-----\n";
- pDescription += it->second[CD_CONTENT];
+ pDescription += content;
pDescription += "\n\n";
}
}
- else if (it->second[CD_TYPE] == CD_ATT)
+ else if (type == CD_ATT)
{
pDescription += "\n\nAttached files\n"
"----\n";
- pDescription += it->first;
+ pDescription += filename;
pDescription += '\n';
}
- else if (it->second[CD_TYPE] == CD_BIN)
+ else if (type == CD_BIN)
{
- error_msg(_("Binary file %s will not be reported"), it->first.c_str());
+ error_msg(_("Binary file %s will not be reported"), filename.c_str());
}
}