Skip to content

Commit

Permalink
chore: clarify why images are removed from rtf-to-html results (#1295)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Mar 2, 2023
1 parent 7582b22 commit 0ef7262
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Docsmith is a RESTful API, built using Node.js and the [Fastify](https://fastify
- DOCX to TXT
- PDF to HTML
- PDF to TXT
- RTF to HTML
- RTF to HTML (images are removed)
- RTF to TXT
- Scanned documents (as PDFs) to TXT using OCR

Expand Down
11 changes: 10 additions & 1 deletion src/plugins/rtf-to-html/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ async function plugin(server, options) {
// Define any default settings the plugin should have to get up and running
const config = {
rtfToHtmlOptions: {
/**
* Images are removed because UnRTF generates image names as `pict001.wmf`,
* `pict002.wmf`, and so on. This poses a confidentiality and clinical risk as,
* should two concurrent requests have the same image name, the second request
* would overwrite the first request's image and that image would be embedded
* into both HTML documents.
*
* We wouldn't want to add one patient's image to another patient's document.
*/
noPictures: true,
outputHtml: true,
},
Expand Down Expand Up @@ -95,7 +104,7 @@ async function plugin(server, options) {
* UnRTF < v0.20.4 ignores `noPictures` option and
* generates img tags whilst placing images in cwd.
*
* UnRTF generates the image name i.e. `pict001.wmf`, `pict002.wmf` and so on.
* UnRTF generates the image name as `pict001.wmf`, `pict002.wmf`, and so on.
* This means files can be safely removed from the cwd without running the
* risk of removing any important files such as `package.json`, should an image
* ever have the same name.
Expand Down
2 changes: 1 addition & 1 deletion src/routes/rtf/html/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const rtfToHtmlPostSchema = {
tags,
summary: "Convert RTF to HTML",
description:
"Returns the result of converting an RTF document to HTML format. Images are discarded.",
"Returns the result of converting an RTF document to HTML format. Images are removed.",
operationId: "postRtfToHtml",
consumes: ["application/rtf"],
produces: ["application/json", "application/xml"],
Expand Down

0 comments on commit 0ef7262

Please sign in to comment.