salimoha / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

uncaught exception when called with wrong regexp #230

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. google docs get -n '*'

What is the expected output? What do you see instead?

If the title parameter contains an invalid regular expression (in this case 
'*') then googlecl should print out an appropriate error message instead of 
just crashing with the following backtrace:

Traceback (most recent call last):
  File "/usr/bin/google", line 536, in <module>
    main()
  File "/usr/bin/google", line 530, in main
    run_once(options, args)
  File "/usr/bin/google", line 408, in run_once
    task.run(client, options, args)
  File "/usr/lib/python2.6/site-packages/googlecl/docs/service.py", line 500, in _run_get
    entries = client.get_doclist(options.title, folder_entries)
  File "/usr/lib/python2.6/site-packages/googlecl/docs/service.py", line 196, in get_doclist
    converter=gdata.docs.DocumentListFeedFromString)
  File "/usr/lib/python2.6/site-packages/googlecl/service.py", line 193, in get_entries
    if entry.title.text and re.match(title,entry.title.text)]
  File "/usr/lib/python2.6/re.py", line 137, in match
    return _compile(pattern, flags).match(string)
  File "/usr/lib/python2.6/re.py", line 245, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat

What version of the product are you using? On what operating system? What
version of gdata-python-client (aka python-gdata)?

$ google --version
google 0.9.8

$ rpm -q python-gdata
python-gdata-2.0.9-2.fc12.noarch

OS: Linux Fedora 12

Please provide any additional information below.
The problem is located in
/usr/lib/python2.6/site-packages/googlecl/service.py
line 183 where re.match is called. Since entry.title.text can contain user 
input and re.match can throw exceptions, the code should catch the "invalid 
regexp"-exception.

Original issue reported on code.google.com by Krause....@gmail.com on 17 Jul 2010 at 6:22

GoogleCodeExporter commented 9 years ago
Thanks for picking up on this. Should be fixed in a bit.

Original comment by tom.h.mi...@gmail.com on 20 Jul 2010 at 3:33

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r353.

Original comment by tom.h.mi...@gmail.com on 20 Jul 2010 at 3:57