On Tue, Mar 14, 2017 at 10:39:34PM +0100, cubit wrote:
> What would be possibility of getting a file manager context menu item to create trusted office document like we have for PDF and img currently.
>
> I think make the document its self safe is hard while keeping the file type but maybe "convert to trusted pdf" would be usable solution?
>
I tend to use tools like catdoc and docx2txt to extract text.
You could, I suppose convert to RTF format, although I dont know if that
is substantially more trusted.
If you want to try converting to trusted pdf, you could insert this in to
/usr/lib/qpdf-convert-server: you'll need to have libreofice installed
in the relevant template.
Below the lines:
# Get the original (untrusted) PDF file...
cat > $INPUT_FILE
INSERT:
if [[ $(mimetype $INPUT_FILE) == *msword ]]; then
loffice --headless --convert-to pdf --outdir /tmp $INPUT_FILE &>/dev/null
cd /tmp
INPUT_FILE="/tmp/$(basename $INPUT_FILE )".pdf
fi
Make this change in the template you use for disposableVMs.
use qvm-create-default-dvm to rebuild your DVMTemplate
Now you should be able to convert msword files to PDF just as you convert
PDFs.
All it's doing is converting doc to PDF via libreoffice and then
processing that PDF as normal - all in the disposableVM
Using the mimetype isn't good, and you'll need to extend that to other
forms for more recent formats, but it's a quick hack that works.(I
think)
It occurs to me that you could use the same trick for all sorts of
"trusted pdf" conversions.
unman