diff options
author | Eldon Stegall <wireshark-gerrit@eldondev.com> | 2017-10-17 14:55:52 +0000 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-10-23 04:42:51 +0000 |
commit | c7918da8a6b28fc515d273c16a9ffca2a4b9e119 (patch) | |
tree | 60d23bbba857826744cc29485d432f46e3bbe296 /ui | |
parent | b74af851471687e258fa7624a498981b77ebdba6 (diff) |
Improve http object export for URLs with long extensions
This allows the export of objects with extensions that may be longer
than the allowed file name of an export (due to underlying filesystem, etc).
The extension detection mechanism previously preserved everything in the file
name after the final ".", but in some cases (especially with long query strings)
this would exceed the allowed maximum file length, and simply refuse to export
the object. Now, if the length of the extension and duplicate number is longer
than the allowable file length, the extension is ignored, and the entire string
is truncated to allow an acceptable export filename.
Bug: 14130
Change-Id: I6fa0281519d031c07a9ac621002ac328f34f54cc
Reviewed-on: https://code.wireshark.org/review/23960
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gtk/export_object_dlg.c | 2 | ||||
-rw-r--r-- | ui/qt/export_object_dialog.cpp | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/ui/gtk/export_object_dlg.c b/ui/gtk/export_object_dlg.c index ba7ce9c136..ee0783827e 100644 --- a/ui/gtk/export_object_dlg.c +++ b/ui/gtk/export_object_dlg.c @@ -160,7 +160,7 @@ eo_save_clicked_cb(GtkWidget *widget _U_, gpointer arg) return; } - safe_filename = eo_massage_str(entry->filename, 256, 0); + safe_filename = eo_massage_str(entry->filename, EXPORT_OBJECT_MAXFILELEN, 0); /* * Loop until the user either selects a file or gives up. diff --git a/ui/qt/export_object_dialog.cpp b/ui/qt/export_object_dialog.cpp index d5b60afbb2..4d3d3dca25 100644 --- a/ui/qt/export_object_dialog.cpp +++ b/ui/qt/export_object_dialog.cpp @@ -312,8 +312,10 @@ void ExportObjectDialog::saveCurrentEntry() return; } + GString *safe_filename = eo_massage_str(entry->filename, EXPORT_OBJECT_MAXFILELEN-path.canonicalPath().length(), 0); file_name = QFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Save Object As" UTF8_HORIZONTAL_ELLIPSIS)), - path.filePath(entry->filename)); + safe_filename->str); + g_string_free(safe_filename, TRUE); if (file_name.length() > 0) { eo_save_entry(file_name.toUtf8().constData(), entry, TRUE); |