undefined method 'size' for nil (NoMethodError) on TIME_PARSER if MDTM command returns something different than a 213 response
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 35
- Forks
- 25
- Avg merge
- 4d 59m
- Merged PRs (30d)
- 2
Description
When
resp = sendcmd("MDTM #{filename}")
returns something different than 213. (E.g., 550 Not a plain file, 502 Command not implemented)
Then the method mdtm
def mdtm(filename)
resp = sendcmd("MDTM #{filename}")
if resp.start_with?("213")
return get_body(resp)
end
#
end
will return nil
and then the method mtime:
def mtime(filename, local = false)
return TIME_PARSER.(mdtm(filename), local)
end
will raise an undefined method 'size' for nil (NoMethodError) on the TIME_PARSER, because value is nil
value = value[0, 97] + "..." if value.size > 100
Easy fix:
def mtime(filename, local = false)
value = mdtm(filename)
TIME_PARSER.(value, local) if value
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the mdtm and mtime methods and trace how a non-213 MDTM response reaches TIME_PARSER. Check the behavior for responses such as 550 and 502, then verify that mtime no longer raises NoMethodError when mdtm returns nil.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100