Weird Trailing Slash at End of Twitter Message - twitter

I am using the following code to show a page with a Twitter box already filled in with a message:
Click me
However, on the page, I am getting this inside the Twitter box:
myMessage/
Note the trailing slash. Any ideas how to fix this?

We have found a workaround for this, where you add the source=webclient parameter, crucially, to the END of the twitter address. When you do this, Twitter no longer adds the trailing slash. However, given how Twitter like to change their formats and codes around, there's no guarantee this will work forever :-)
For example...
Twitter this

No, the solution is more simple. URL-encode your url :
https://twitter.com/intent/tweet?text=myMessage&url=http%3A%2F%2Fmyurl.com

Add a trailing slash to your URL and that should go away. It worked for me.
Change the URL from this:
http://www.twitter.com/share?url=http://myurl.com&text=myMessage
To this:
http://www.twitter.com/share?url=http://myurl.com/&text=myMessage

As Twitter documentation claims (twitter original reference):
A fully-qualified URL with a HTTP or HTTPS scheme, URL-encoded.
Fully-qualified URL requires to have trailing slash.
From the same documentation:
Example Value: http:%3A%2F%2Fexample.com%2F
Note, that the example has %2F at the end, which is HTML encoded / character. Twitter tries to create correct URL by appending / automatically.
Set your url GET parameter to http://myurl.com/ to get rid of the trailing slash

Related

URL Escaping with Unity (Firebase URL)

I am trying to download a image stored in the Firebase Storage, using Unity. I use Unity Firebase SKD (in Beta...). This is my code:
...
// Points to "1/preview.jpg"
Firebase.Storage.StorageReference img_ref = folder1_ref.Child("/preview.jpg");
// Fetch the download URL
img_ref.GetDownloadUrlAsync().ContinueWith(task => {
Debug.Log(task.Result.ToString());
});
The console output is:
https://firebasestorage.googleapis.com/v0/b/insidehome-29c9e.appspot.com/o/1/preview.jpg?alt=media&token=092a8de8-5047-4bce-b179-edd4101847a3
If I try to download the file using www or a browser, with this URL, I obtain an error. The good URL should be (copied by Firebase console):
https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Finsidehome-29c9e.appspot.com%2Fo%2F1%2Fpreview.jpg%3Falt%3Dmedia%26token%3D092a8de8-5047-4bce-b179-edd4101847a3
The difference is only in a single slash ("/") before the word "preview".
Is this strange? How could I fix it? I try Escape the URL but it change all the slash:
https%3A%2F%2Ffirebasestorage.googleapis.com%2Fv0%2Fb%2Finsidehome-29c9e.appspot.com%2Fo%2F1%2F99%2Fobama.jpg%3Falt%3Dmedia%26token%3D8a33f998-e271-4d7e-8848-356a332b7750
And It does't work. I need to change only the parameters (right) slash
Hi Firebase engineer here. This is a bug and I'm sorry you encountered this. There should be no slash after "/o/". The 2 slashes surrounding the letter "o" are valid, but every forward slash after that should be displayed as %2F.
This is not a general escaping issue as you should not re-escape the entire URL. This is a side effect of a related mono issue in unity where the Uri class incorrectly decodes %2F into a slash when it shouldn't.
You can work around this by simply replacing slashes after "/o/" with %2F. However, you should know about a corresponding issue with UnityWebRequest:
https://issuetracker.unity3d.com/issues/unitywebrequest-dot-url-unescapes-escaped-symbol
where Unity's libraries are also being affected by this bug (so it may break even if you fix the string and pass it back to unity). It looks like that issue was fixed in 5.5.1 (and I've verified it in 5.6 beta).
On the firebase side, we will change our code to account for this issue in mono so it returns the correct url. Until we get this fix out, I suggest using the workaround of replacing slashes or simply use Firebase itself to download the file.
You can use Unity's WWW.EscapeURL to escape url.
string escapedUrl = WWW.EscapeURL("http://www.someurl");

UTM Tags and Anchors in URL

In my work we use a CMS, and I'm not entirely sure how everything is set up, but I'm having issues using anchors in my links. For example, when I have a link to another portion of the site and I try to append an anchor, such as mysite.com#video-anchor, the url inside of the <a></a> tags gets appended with UTM tags: "mysite.com/utm_campaign=...", and the #video-anchor just doesn't show up in the final URL. The result is just linking to the page, but without scrolling to the anchor that I specified. Any help?
You should use the #anchor parameter at the end, with the UTM after the URL, like this
www.yousite.com/page?utm_source=XXX&utm_medium=XXX&utm_campaign=XXX#video-anchor
This sounds like an issue with the CMS rather than anything to do with Google Analytics. I would contact support for the CMS, or edit your question title nad tag to include the name of the CMS.
Anchors don't work as they usually do when you add utm's to a URL. In fact, they break the UTM altogether. Make sure you're adding the anchor to the end of the UTM query string if you want it to work. This Webmasters post should help:
https://webmasters.stackexchange.com/q/35413/13067

FormIt - redirect hook issue

ISSUE: I'm using FormIt and the redirect hook is not working for me.
It is redirecting to http://www.example.comPageName.html instead of http://www.example.com/PageName.html. It is not placing the forward slash after the page name.
Has anyone seen this issue before?
Here is my FormIt snippet.
[[!FormIt? &hooks=`email,redirect` &emailTpl=`MyEmailChunk` &emailTo=`mypersonalemail#email.com` &emailSubject=`Contact Us form submission` &redirectTo=`35` &emailFrom=`info#domainnamme.com`]]
Yes, the MyEmailChunk exists.
The email addresses are dummy values
The resource with id 35 is in the same context and is published and is hidden from the menus.
I'm using friendly urls.
If I try another resource it works.
URL generated in the following code
$url = $this->modx->makeUrl($this->formit->config['redirectTo'],$contextKey,$redirectParams,'full');
'full' means URL is absolute, prepended with site_url from config ( http://rtfm.modx.com/display/revolution20/modX.makeUrl ). Please check your site_url variable in /core/config/config.inc.php
Actually the site_url variable needs to be checked in the System Settings.
Make sure you have a trailing slash.

Tapestry "/" in parameters bug

If I add slash / to the parameter of a page, even in encoded form %2F I get an error.
Sample URL:
http://mywebsite.com/somepage?param=dfgdfg%2F
Error:
Input string 'dfgdfg/' is not valid; the character '/' at position 7 is not valid.
I am trying to pass whole URL as parameter (to later redirect user to that URL) so there are a lot of slashes in there.
Is this a bug? Is there any workaround?
I could theoretically replace all slashes with something else than %2F but that is something I would attempt after everything else fails...
As I've learned this happens on Jetty only, which I use for development...
This custom service override solved the problem:
http://tapestry.1045711.n5.nabble.com/Customising-T5-URL-Encoding-tp2412550p2412551.html
Looks very hacky but works :).
See the Web Services More example on the JumpStart page. Works for me on Jetty.
The JumpStart page has many "how-to-do-this-in-Tapestry" examples.

How does one escape the # sign in a Url pattern in UrlMappings.groovy?

In order to maintain the current set of Urls in a project, I have to be able to use the # (pound sign) in the Url. For some reason the pound sign does not appear to work normally in this project for UrlMappings.groovy.
Is there a special escape-sequence that must be used when placing # signs in UrlMappings.groovy?
Am I missing some reason why one cannot use pound signs at all?
In the following URL Mapping example, the browser goes to the correct page, but the pageName variable is null:
"/test/${urlName}#/overview"(controller:'test', action:'overview') {
pageName = "overview"
}
I thought everything after # in the url would be treated on the client side of the browsers where it tries to find a and scroll to that location.
If you dump the request containing the pound char, do you even see the data behind #?
I used a Named URL mapping and it works fine, no need to escape the "#" sign:
name test: "/#abc" (controller: 'test', action:'homepage')
EDIT: My above answer is wrong. In fact, it falls to a special case when homepage is the default action of the view.
Netbrain is right, the path after "#" will never be sent to server. In stead, I found that it's possible using "%23" instead of "#". Please take a look at here.
For example, instead of /test#/abc we should use /test%23/abc as URL mapping (both at client side & server side).

Resources