Commit 8ca94d71 authored by Andrea Azzarone's avatar Andrea Azzarone 🚴

tracker-extract: Fix handling of (atend) in ps files

Properly handle (atend) when parsing Postscript file. Also add a test
case.
parent 3752c094
......@@ -101,6 +101,8 @@ extract_ps_from_inputstream (GInputStream *stream)
g_autoptr(GDataInputStream) data_stream = NULL;
gchar *line;
gsize length, accum, max_bytes;
gboolean pageno_atend = FALSE;
gboolean header_finished = FALSE;
g_autoptr(GError) error = NULL;
metadata = tracker_resource_new (NULL);
......@@ -114,9 +116,6 @@ extract_ps_from_inputstream (GInputStream *stream)
while ((accum < max_bytes) &&
(line = g_data_input_stream_read_line (data_stream, &length, NULL, &error)) != NULL) {
gboolean pageno_atend = FALSE;
gboolean header_finished = FALSE;
/* Update accumulated bytes read */
accum += length;
......
......@@ -16,7 +16,8 @@ extractor_tests = [
'office/office-doc',
'office/powerpoint',
'office/pdf-doc',
'office/ps-doc'
'office/ps-doc',
'office/ps-doc-atend'
]
if get_option('unzip_ps_gz_files')
......
{
"test": {
"Filename": "ps-doc-atend.ps",
"Comment": "PS document from the office tools"
},
"metadata": {
"nfo:pageCount": 1,
"nie:copyright": "copyleft",
"nco:creator": {
"nco:fullname": "vi",
"@type": "nco:Contact"
},
"@type": "nfo:PaginatedTextDocument"
}
}
%!PS
%%Copyright: copyleft
%%Title: Hello World!
%%Creator: vi
%%Pages: (atend)
%%EndComments
/Courier
20 selectfont
72 500 moveto
(Hello world!) show
showpage
%%Trailer
%%Pages: 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment