Jump to content

Help: Hashtag/Number Sign Converting to %23 in Custom Workflow


Recommended Posts

I have a custom search workflow and the url has a hashtag in it. The # is converting to %23 when I search. I see that you can escape quotes, backslashes and dollar signs, but can't figure out how to make it so the hashtag isn't converted.

 

Here is my workflow. Any help would be appreciated.

 

$input = trim("{query}");
 
if ( empty( $input ) ):
else:
endif;
Link to comment

 

I have a custom search workflow and the url has a hashtag in it. The # is converting to %23 when I search. I see that you can escape quotes, backslashes and dollar signs, but can't figure out how to make it so the hashtag isn't converted.

 

Here is my workflow. Any help would be appreciated.

 

$input = trim("{query}");
 
if ( empty( $input ) ):
else:
endif;

 

 

Is there any way that you could share the workflow that you've created? Using the code above (slight mod to the url) works for me. I wanna see if there's anything messed up in the configuration for it.

Link to comment

I did a little more testing with this. The search works if the search term is only word. 

 

If the search term has a space in it, the search fails.

 

Here is a working query: http://cl.ly/image/1a0L3z1r1Z0O

 

Here is a query with two words:  http://cl.ly/image/1u1n0N1c173T

 

It looks like the issue is the url encoding..

 

When you add the second term, the %20 in the url is fine, thats the space encoded, the %23 is a backslash where it tried to escape the space in the text. Space escaping in the workflow should probably be disabled. As for the %5C, thats the hash obviously getting escaped. How to stop that, I'm not sure because bash is doing it. Is there some reason why you are using a workflow to do this as opposed to just a custom search? If you use the Custom Search functionality built in to Alfred, then it would only encode the query portion of the url and it works fine. If you wanted the fallback like you have setup, you could create a second Custom Search with the same keyword and just don't add {query} to the url and it wouldn't look for data passed to it so... you type 'hn' and it shows both items as selectable, as soon as you hit the space though to enter your query, the other disappears.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...