Skip to content
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

Errno::ENOENT on expense attachments #3

Open
alexjamesbrown opened this issue Oct 28, 2014 · 13 comments
Open

Errno::ENOENT on expense attachments #3

alexjamesbrown opened this issue Oct 28, 2014 · 13 comments
Assignees

Comments

@alexjamesbrown
Copy link
Contributor

When running, I get an error when it tries to do the expense attachments
(note, this is running using my fork, with the date in the filename - see pull request #2) however, this happened before I made this change too

/private/var/mobile/Applications/7EFCAB78-BCD0-420E-B821-B107FD553270
.. looks suspicious to me?

retrieving expense attachments
.....................................fetch.rb:315:in initialize': No such file or directory - /users/alex/Desktop/stuff/1970-1-31_2099-1-31/expenses/2012-11-01-2119881-/private/var/mobile/Applications/7EFCAB78-BCD0-420E-B821-B107FD553270/Documents/expenseimages/3.jpg (Errno::ENOENT) from fetch.rb:315:inopen'
from fetch.rb:315:in block (2 levels) in download_file' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1413:inblock (2 levels) in transport_request'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:162:in reading_body' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1412:inblock in transport_request'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1403:in catch' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1403:intransport_request'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1376:in request' from fetch.rb:314:inblock in download_file'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:852:in start' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:582:instart'
from fetch.rb:311:in download_file' from fetch.rb:349:inblock (2 levels) in retrieve_expenses'
from fetch.rb:252:in call' from fetch.rb:252:inblock in each'
from fetch.rb:252:in each' from fetch.rb:252:ineach'
from fetch.rb:347:in block in retrieve_expenses' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/csv.rb:1266:inopen'
from fetch.rb:345:in retrieve_expenses' from fetch.rb:400:in

'

@iamkeir
Copy link

iamkeir commented Dec 9, 2014

Did you manage to get round this? I am getting it, too.

@iamkeir
Copy link

iamkeir commented Dec 9, 2014

Looks like it is the filename retrieved from FA and containing a '/' causes it to choke. Just digging in code to see what can be done.

@alexjamesbrown
Copy link
Contributor Author

Yeah...
I'm not sure how / if i fixed it... will have a look at local version of it

@iamkeir
Copy link

iamkeir commented Dec 9, 2014

Thanks dude. I was thinking of sanitising the URL string to swap characters that would cause a crash to hyphens or similar. Or strip the path from the filename. Still investigating but your input would be really useful!

@alexjamesbrown
Copy link
Contributor Author

yeah, i didn't do anything - not sure if i got round it. kinda gave up in the end i think!

@iamkeir
Copy link

iamkeir commented Dec 9, 2014

Aww man, bummer. Ok, well I will post if I have any luck.

@alexjamesbrown
Copy link
Contributor Author

cool, ruby isn't my 1st lang, so i was a bit slow with it...
i have a feeling i renamed the files somehow.. so def on right track!

@iamkeir
Copy link

iamkeir commented Dec 9, 2014

Yep, found the cause - filename with slashes: 2011-02-05-4600531-/private/var/mobile/Applications/8A9ABDED-8B81-4D2A-9B81-C855B72B42CF/Documents/expenseimages/b50a3360489a4690957976a516bbc888.jpg

Just working a fix now.

@iamkeir
Copy link

iamkeir commented Dec 10, 2014

I did a quick and dirty fix for now, changed line 53 to:
@data["file_name"].tr('/','_') # sanitise paths

This basically sanitises '/' in the filename that could cause it to crash - although I think it would be better if it ditched the excessive path filename, or used regex.

@iamkeir
Copy link

iamkeir commented Dec 10, 2014

Here ya go, all fixed: https://github.com/iamkeir/freeagent-receipts

Just need to get it merged!

@tooky
Copy link
Owner

tooky commented Dec 10, 2014

Apologies for the lack of communication on this. I'll take a look at both of these on Friday and try and get them merged in.

Thanks for the contribution 👍

@tooky tooky self-assigned this Dec 10, 2014
@iamkeir
Copy link

iamkeir commented Dec 10, 2014

:D

@alexjamesbrown
Copy link
Contributor Author

looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants