koniu / recoll-webui

web interface for recoll desktop search
266 stars 55 forks source link

UnicodeDecodeError - Error 500 #32

Closed Percent01 closed 8 years ago

Percent01 commented 10 years ago

Hi,

I get his error message, when I would like to search something in specific directory. (the directory include special eastern europe character)

Error 500: Internal Server Error Sorry, the requested URL 'http://xxxxxx.com/results?query=&dir=search_directory%2FPodiv%C3%ADnsk&after=&before=&sort=relevancyrating&ascending=0&page=1' caused an error:

Internal Server Error Exception:

UnicodeDecodeError('ascii', ' dir:"output/Podiv\xc3\xadnsk" ', 45, 46, 'ordinal not in range(128)') Traceback:

Traceback (most recent call last): File "/Desktop/recoll/recoll-webui/bottle.py", line 744, in _handle return route.call(_args) File "/Desktop/recoll/recoll-webui/bottle.py", line 1479, in wrapper rv = callback(_a, _ka) File "/Desktop/recoll/recoll-webui/bottle.py", line 2850, in wrapper result = func(_args, **kwargs) File "/Desktop/recoll/recoll-webui/webui.py", line 240, in results qs = query_to_recoll_string(query) File "/Desktop/recoll/recoll-webui/webui.py", line 151, in query_to_recoll_string qs += " dir:\"%s\" " % q['dir'] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 45: ordinal not in range(128)


I modified the pasted URL.

koniu commented 10 years ago

duplicate of #26, pushed a suggested fix. please try if it works now.

Percent01 commented 10 years ago

Almost complete solution, but... I replace with this webui.py line 151 qs += " dir:\"%s\" " % q['dir'].decode('utf-8') Now the search is fine, but unfortunately I can't download or preview the file yet. This is the error message, what I get when I would like to preview the file:

Error 500: Internal Server Error Sorry, the requested URL 'http://xxxxxx.com/preview/0?query=a&dir=outputxxxxxxxx&after=&before=&sort=relevancyrating&ascending=0&page=1' caused an error:

Internal Server Error

Exception: AttributeError('internfile failure',)

Traceback: Traceback (most recent call last): File "Desktop/recoll/recoll-webui/bottle.py", line 744, in _handle return route.call(*_args) File "Desktop/recoll/recoll-webui/bottle.py", line 1479, in wrapper rv = callback(_a, **ka) File "Desktop/recoll/recoll-webui/webui.py", line 267, in preview tdoc = xt.textextract(doc.ipath) AttributeError: internfile failure


This error message get

Error 500: Internal Server Error
        <style type="text/css">
          html {background-color: #eee; font-family: sans;}
          body {background-color: #fff; border: 1px solid #ddd;
                padding: 15px; margin: 15px;}
          pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}
        </style>
    </head>
    <body>
        <h1>Error 500: Internal Server Error</h1>
        <p>Sorry, the requested URL <tt>&#039;http://xxxxxxxx.com/download/1?query=a&amp;dir=output%2Fxxxxxxxxxx&amp;after=&amp;before=&amp;sort=relevancyrating&amp;ascending=0&amp;page=1&#039;</tt>
           caused an error:</p>
        <pre>Internal Server Error</pre>
          <h2>Exception:</h2>
          <pre>UnicodeEncodeError(&#039;ascii&#039;, u&#039;Sending /srv/output/xxxxx.eml with mimetype message/rfc822&#039;, 59, 60, &#039;ordinal not in range(128)&#039;)</pre>
          <h2>Traceback:</h2>
          <pre>Traceback (most recent call last):

File "Desktop/recoll/recoll-webui/bottle.py", line 744, in _handle return route.call(*_args) File "Desktop/recoll/recoll-webui/bottle.py", line 1479, in wrapper rv = callback(_a, **ka) File "Desktop/recoll/recoll-webui/webui.py", line 298, in edit print >> sys.stderr, "Sending %s with mimetype %s" % (path, doc.mimetype) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 59: ordinal not in range(128)

koniu commented 10 years ago

I cannot reproduce this error, just checked with the latest webui code and it works fine here. Looking at the error messages I gather you're using an older revision or a fork - is there a specific reason for that or can you pull the latest revision and test?

Percent01 commented 10 years ago

I use the newest !official! version, but I will check again very soon.

This code snippet solve the problem, when I would like to search in directory, where directory name's contain special character: .decode('utf-8')

But when I would like to download or preview one of the result I get the error message above. I think the problem these characters: ˇ ^ ° Could you try it, when you have a file with special character with a special chacter directory and indexing and after would like download with recoll-webui? For example: <directory'+!(ˇ^°name>/<file'+!(ˇ^°name>

Thanks in advance for any help you are able to provide.

Percent01 commented 10 years ago

I think in the new version you miss the "Download" button from the "result.tpl"

Please put this line into result.tpl under the 'preview' part: < a href="download/{{number-1}}?{{query_string}}">Download< /a>

Percent01 commented 10 years ago

I would like to clarify the problem: I can't download files when the objects in the a specific file. For example I search in emails attachment and the directory or the file name contain "*" asterisk character.

ghost commented 10 years ago

Hi,

I'd gladly look at the issue, but I'd need a sample of a document which exhibiting the problem.

Either attach it here or send it to me by email: jf at dockes . org

If the sample document is an email, please don't forward it, as this might cause re-encoding somewhere along the transfer. Save it to an mbox or eml file, zip or gzip it, and send the result.

jf

koniu commented 8 years ago

no reply