mod-audio / mod-sdk

SDK to implement the MOD gui interface
GNU General Public License v3.0
34 stars 16 forks source link

cannot generate screenshots of plugins with hash in the URI #1

Closed x42 closed 6 years ago

x42 commented 8 years ago

The problem is double-encoding of the percent and the hash. Note the "%2523" which should be %23 below.

The actual error from the server:

To start testing your plugin interfaces, open your webkit-based browser (Google Chrome, Chromium, Safari) and point to http://localhost:9000
get failed
WARNING:tornado.access:404 GET /effect/get/?uri=http%3A%2F%2Fgareus.org%2Foss%2Flv2%2Fmidifilter%2523channelfilter (::1) 0.70ms
ERROR:tornado.application:Uncaught exception GET /screenshot?uri=http%3A%2F%2Fgareus.org%2Foss%2Flv2%2Fmidifilter%23channelfilter&width=330&height=330 (::1)
HTTPServerRequest(protocol='http', host='localhost:9000', method='GET', uri='/screenshot?uri=http%3A%2F%2Fgareus.org%2Foss%2Flv2%2Fmidifilter%23channelfilter&width=330&height=330', version='HTTP/1.1', remote_ip='::1', headers={'Accept-Language': 'en-US,en;q=0.5', 'Dnt': '1', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'X-Requested-With': 'XMLHttpRequest', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0', 'Host': 'localhost:9000', 'Referer': 'http://localhost:9000/', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive'})
phantomjs --debug=yes  screenshot.js "http://localhost:9000/icon.html#http://gareus.org/oss/lv2/midifilter#keysplit" /tmp/test.png 300 300

[...]
2016-08-09T10:35:45 [DEBUG] WebPage - setupFrame ""
2016-08-09T10:35:45 [DEBUG] Network - Resource request error: QNetworkReply::NetworkError(ContentNotFoundError) ( "Error transferring http://localhost:9000/effect/get/?uri=http%3A%2F%2Fgareus.org%2Foss%2Flv2%2Fmidifilter%2523keysplit - server replied: Not Found" ) URL: "http://localhost:9000/effect/get/?uri=http%3A%2F%2Fgareus.org%2Foss%2Flv2%2Fmidifilter%2523keysplit"
2016-08-09T10:35:50 [DEBUG] WebPage - setupFrame ""
2016-08-09T10:35:50 [DEBUG] WebPage - updateLoadingProgre
[....]

this simple diff works around it

diff --git a/modsdk/webserver.py b/modsdk/webserver.py
index 883d90d..cd4b26e 100644
--- a/modsdk/webserver.py
+++ b/modsdk/webserver.py
@@ -120,6 +120,7 @@ class EffectList(web.RequestHandler):
 class EffectGet(web.RequestHandler):
     def get(self):
         uri = self.get_argument('uri')
+        uri = uri.replace('%23', '#')

         try:
             data = get_plugin_info(uri)

50c18ed using Python 3.5.2 on current debian/testing

brummer10 commented 7 years ago

Hi I can confirm Robins fix, I just run in the same trap, just would report it here and find the solution already mentioned. Thanks Robin.

ssj71 commented 6 years ago

pardon my language, but its about freaking time.... Thanks.