-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command fails on UNC path containing spaces #83
Comments
Thanks for reporting this @thegoatherder, I'll take a look! |
Thanks, it would save my bacon in a project if it were fixed. I did try to
fork and fix but half your tests failed afterwards... can try again if you
need help.
|
Are you able to give the changes on the I've tested this locally (using Windows 10 and node v14.17.0, with Windows Server 2019 holding the test file) using the following and it's all ok: const unRtf = new UnRTF();
const options = {
noPictures: true,
outputText: true,
};
const res = await unRtf.convert(
"\\\\test-server\\c$\\test files\\test rtf simple whitespace.rtf",
options
); |
Apologies for the delay on this, I should be able to test it tomorrow. Will
let you know. --
…-----------------------------------------------------------
"Are you sleep walking through your waking life
...or wake walking through your dreams?"
|
@Fdawgs it's still not working for me. I ran I've noticed that the output command has changed now from using backslash paths to forward slash paths, which I believe should be cross-platform for bash/powershell (but not cmd prompt). However, it still is failing. When I copy the command it is generating from the error object into a terminal, it still fails (tested in bash, powershell, windows cmd and node debug terminals). If I take the same command and surround the path with quotes, it works immediately. Input const unRtf = new UnRTF();
const options = {
noPictures: true,
outputText: true,
};
const res = await unRtf.convert(
"\\\\someserver\\p$\\Document Extract Second Run\\2016-08-19\\Some Folder/111111_250_0___11111111_person_201608191353502CO02_2.rtf.rtf",
options
); Output Error: {"killed":false,"code":3221225477,"signal":null,"cmd":"G:/myproject/node_modules/node-unrtf/src/lib/win32/unrtf-0.19.3/bin/unrtf --nopict --text //someserver/p$/Document Extract Second Run/2016-08-19/Some Folder/111111_250_0___11111111_person_201608191353502CO02_2.rtf.rtf","stdout":"","stderr":""} Copy this command to a terminal and it fails:
Copy same command to a terminal and quote the target filename:
... and it successfully extracts the text. Weird? |
any ideas on this? Let me know if there's anything I can do to help, it's a major blocker for the project I'm working on. |
@thegoatherder Going to revisit it tomorrow. 😊 |
@Fdawgs Apologies, but I'm starting to think my bug report may have been in error. I have just spent some more time testing both the Could it be that the unrtf.exe file is being run with a different user credential than the parent node application? If so do you have any idea which user I need to give permissions to on the folder? My app is also using other libs like
|
@Fdawgs i tried some more stuff last night, it didn’t work, but here are some notes:
If you have any ideas I’m all ears. My gut says it’s 50% likely to be a security thing, 50% something else. It’s also telling me to stop being stupid and just run Docker! Do you run Docker Desktop on top of windows server? Or are you using Docker Enterprise or Docker on Linux? Is Docker Desktop on Windows Server good enough for production use? |
@thegoatherder After further investigation, I believe it may be down to the version of UnRTF and the RTF spec supported. UnRTF v0.19.3 (which is included with this module for Windows) was released in 2004, when v1.8 of the RTF specification was standard. RTF v1.9 was released in 2007, and MS Word 2007 onwards saves new RTFs using v1.9.1. If i send the same document generated from MS Word 2016 to Docsmith (which uses UnRTF v0.21.10 when ran under Docker), the document converts fine! I would suggest running your application under Docker to get the latest version of UnRTF. I will add a note to the documentation regarding the use of the included UnRTF binary and it only being able to handle RTFs up to v1.8 |
@Fdawgs This theory doesn’t explain why copying the command from the UnRTF error object returned by node.js works when pasted into a powershell window... the same command extracts text to the terminal without error... |
From what I can see, Node watches the error code and if it's not So, if i run one of these old files in the command line: $ C:/Repositories/public/modules/node-unrtf/src/lib/win32/unrtf-0.19.3/bin/unrtf C:/Repositories/public/modules/node-unrtf/test_files/test-rtf-simple.rtf && echo $?
Processing C:/Repositories/public/modules/node-unrtf/test_files/test-rtf-simple.rtf...
<html>
<head>
<!--- Translation from RTF performed by UnRTF, version 0.19.3 --->
<!--- For information about this marvellous program, --->
<!--- please go to http://www.gnu.org/software/unrtf/unrtf.html --->
<!--- document uses ANSI character set --->
<!--- font table contains 8 fonts total --->
<!--- creaton date: 2 July 2020 19:05 --->
<!--- revision date: 2 July 2020 19:05 --->
<!--- last printed: --->
</head>
<body><font color="#000000"><font face="Liberation Serif"><font size=3></font></font></font><font color="#000000"><font face="Liberation Serif"><font size=3>Ask not what your country can do for you, ask what you can do for your country.</font></font></font><font color="#000000"><font face="Liberation Serif"><font size=3><br>
</font></font></font></body>
</html>
Done.
174 words were hashed.
0 <--- error code And if i run one of the newer RTFs: $ C:/Repositories/public/modules/node-unrtf/src/lib/win32/unrtf-0.19.3/bin/unrtf C:/Repositories/public/modules/node-unrtf/test_files/Testr2.rtf && echo $?
This is UnRTF, version 0.19.3
By Dave Davey and Marcos Serrou do Amaral
Original Author: Zach T. Smith
Processing C:/Repositories/public/modules/node-unrtf/test_files/Testr2.rtf...
<html>
<head>
<!--- Translation from RTF performed by UnRTF, version 0.19.3 --->
<!--- For information about this marvellous program, --->
<!--- please go to http://www.gnu.org/software/unrtf/unrtf.html --->
<!--- document uses ANSI character set --->
<!--- font table contains 99 fonts total --->
<!--author: Frazer Smith--->
<!--- creaton date: 7 June 2021 10:19 --->
<!--- revision date: 7 June 2021 10:20 --->
<!--- total pages: 1 --->
<!--- total words: 1 --->
<!--- total chars: 6 --->
<!--- invalid font number 31506 --->
</head>
<body><span style="font-size:11pt"></span><span style="font-size:11pt">Testr2</span><span style="font-size:11pt"></span><span style="font-size:11pt"><br>
</span><span style="font-size:11pt"></span><span style="font-size:11pt"></span><span style="font-size:11pt"></span><span style="font-size:11pt"></span><span style="font-size:11pt"></span><span style="font-size:11pt"></span><span style="font-size:11pt"></span><span style="font-size:11pt"></span><span style="font-size:11pt"></span>Segmentation fault
139 <--- error code When you've tested your documents in the command line, does it generate the document but also throw up some sort of text to indicate there may be something wrong? Looking at the one above, it has the |
Afternoon @thegoatherder, have you had the chance to retest this? 😸 |
Not yet. We moved to Docker to get around this. However I should test it on
windows and let you know anyway. I did run it through at some point but
then remembered we have some regex replacements that strips out all those
tags, so I couldn’t see if they were there...!
I’ll check with a breakpoint instead soon.
On Tue 22 Jun 2021 at 13:32, Frazer Smith ***@***.***> wrote:
Afternoon @thegoatherder <https://github.com/thegoatherder>, have you had
the chance to retest this? 😸
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#83 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC7EJF5UQ4SPLSYFTM27J3TUB7FZANCNFSM453HPSXQ>
.
--
…-----------------------------------------------------------
"Are you sleep walking through your waking life
...or wake walking through your dreams?"
|
Describe the bug
Promise returns
Command failed
when the target filename is a windows UNC path containing spacesTo Reproduce
If I copy the unrtf command generated into the terminal and wrap the file path with
"
double quotes, the command succeeds.The text was updated successfully, but these errors were encountered: