Advertisement:

Author Topic: [SMF 2.0.2] WYSIWYG editor wrongly formates URL without the "http" prefix  (Read 19879 times)

Offline Masterd

  • SMF Hero
  • ******
  • Posts: 3,895
  • Gender: Male
I'm sorry if this has been reported before but it seems that I can't find a topic related to it.

Oh boy, I'm getting old. I found this out when I was testing RC3 few years ago (or was it a year ago?) when I had some rather serious business (well, it depends on your definition of serious :P) and I wrote it down so I can report it later. Unfortunately I forgot about this until today.

Replication was successful on several sites running the latest SMF 2.0.2. It is replicable on this site. Simply, if you enable WYSIWYG and then enter an URL without the "http" prefix, for example: www.something.com, it will be wrongly formated so now it will link to http://www.forum.com/www.something.com.     
« Last Edit: August 18, 2012, 09:50:42 AM by Trekkie101 »

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 69,631
    • StoryBB/StoryBB on GitHub
That's not really a bug in the editor, that's how HTML actually works if you do a link without the http in front of it...
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline FrizzleFried

  • Drama-Monger
  • Sr. Member
  • ****
  • Posts: 755
I think he's saying it's not just adding the http:// but an additional URL...?


Offline Masterd

  • SMF Hero
  • ******
  • Posts: 3,895
  • Gender: Male
That's not really a bug in the editor, that's how HTML actually works if you do a link without the http in front of it...

To be honest, I never actually took a look at the WYSIWYG editor's code but I always thought it was coded to "apprehend" such things.


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 69,631
    • StoryBB/StoryBB on GitHub
Why should it, when the browser won't anyway?

I think he's saying it's not just adding the http:// but an additional URL...?

Yes, it'll put the forum's domain (and possibly path, circumstance depending) in front of it - because that's how HTML itself deals with such things.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Masterd

  • SMF Hero
  • ******
  • Posts: 3,895
  • Gender: Male
Why should it, when the browser won't anyway?

This is What You See I What You Get editor, right?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 69,631
    • StoryBB/StoryBB on GitHub
It doesn't really matter whether it is or not.

Add this to your template somewhere: <a href="mypage.html">my page</a> and where does the link take you? It certainly doesn't take you to http://mypage.html
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Masterd

  • SMF Hero
  • ******
  • Posts: 3,895
  • Gender: Male
It doesn't really matter whether it is or not.

Add this to your template somewhere: <a href="mypage.html">my page</a> and where does the link take you? It certainly doesn't take you to http://mypage.html

Ofcourse not. It's just the way how HTML behaves. But here we are talking about "super advanced Web 2.0 editor". The main role of using WYSIWYG editor is to get what you see. And in this case it's simply not happening.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
There is for sure an inconsistency.
If I simply write:
Code: [Select]
www.something.comin the normal editor what I get is a link to:
Code: [Select]
http://www.something.comwhile using the WYSIWYG what I obtain is a link to:
Code: [Select]
http://www.simplemachines.org/community/www.something.comso I feel one of the two is wrong.

BTW in 2.1 there is a similar situation, but less evident since the http://www.simplemachines.org/community/www.something.com will appear only as title of the link in the WYSIWYG editor but will not be converted by the editor itself.


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline FrizzleFried

  • Drama-Monger
  • Sr. Member
  • ****
  • Posts: 755
I'd like to put forward that if a user types

Code: [Select]
www.anything.com
 ... if they get something OTHER than

Code: [Select]
http//www.anything.com
as the end result... that would be the wrong way of doing things.  I don't "care" how HTML works... the bottom line is that it is illogical to expect anything other than the same URL you type in but PERHAPS with the http:// added... to be a true WYSIWYG... no?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 69,631
    • StoryBB/StoryBB on GitHub
No, because other editors do exactly the same thing, because yo udon't always want absolute links, there are plenty of times you just want to link to somewhere else on the same site...
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

MrPhil

  • Guest
I would rather see the whole "auto link" business dropped. You want a domain name to be a link? You wrap it in [url]http:// .. [/url]. Right now SMF is assuming anything starting with www. (but not http://www.) is an implied link. I think this has caused more problems (and work) than it has saved typing. It's also inconsistent (mysub.domain.com is not linked). As an example, there's another thread going on about [img]http://cache.www.domain.com getting turned into [img]http://cache.[url]www.domain.com.

Even in this simple post, I had to add "nobbc" tags to stop SMF from turning URLs into links.

Offline Trekkie101

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,157
  • Gender: Male
  • Ad Astra!
    • https://www.facebook.com/DLRPRoundup on Facebook
    • @dlrproundup on Twitter
    • DLRP Roundup
Still bugs up with new editor.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Are you sure?
I just tested it again, but it seems to work "properly": it is not changed and it is auto-linked when displayed.


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Trekkie101

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,157
  • Gender: Male
  • Ad Astra!
    • https://www.facebook.com/DLRPRoundup on Facebook
    • @dlrproundup on Twitter
    • DLRP Roundup
Hit the URL button, delete the http:// and just put www.startrek.com in and it doesn't work?

Offline FrizzleFried

  • Drama-Monger
  • Sr. Member
  • ****
  • Posts: 755
www.startrek.com

Sure looked to work fine here.

Actually nope... it's jacked.  Click the URL button,  put in www.startrek.com and the above URL comes up...

(hxxp://www.simplemachines.org/community/www.startrek.com) with the proper URL NAME attached.  Something is seriously screwed up.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Hit the URL button, delete the http:// and just put www.startrek.com in and it doesn't work?
Did you also post the message?
It looks fine here once posted.
The resulting message contains:
Code: [Select]
[iurl=http://www.something.com]www.something.com[/iurl]though that means I have to fine tune the distinction between url and iurl...


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Trekkie101

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,157
  • Gender: Male
  • Ad Astra!
    • https://www.facebook.com/DLRPRoundup on Facebook
    • @dlrproundup on Twitter
    • DLRP Roundup
I was trying it with the latest git, and its there.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
So even with the new editor the resulting post is with the http://yoursite.com/www.anothersite.tld?
What browser are you using?


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Trekkie101

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,157
  • Gender: Male
  • Ad Astra!
    • https://www.facebook.com/DLRPRoundup on Facebook
    • @dlrproundup on Twitter
    • DLRP Roundup
So even with the new editor the resulting post is with the http://yoursite.com/www.anothersite.tld?
What browser are you using?

Yes, Safari 6, I'm sending you a PM with details to have a play.

Offline FrizzleFried

  • Drama-Monger
  • Sr. Member
  • ****
  • Posts: 755
So even with the new editor the resulting post is with the http://yoursite.com/www.anothersite.tld?
What browser are you using?

I tried it with Firefox 14.0.1


I will try with Chrome in a minute.

Offline FrizzleFried

  • Drama-Monger
  • Sr. Member
  • ****
  • Posts: 755
OK... using Chrome 21.0.1180.79 m

I am now going to try to use the URL button with the url www.testforum.com to see the result...


www.testforum.com


EDIT: As you can see above... even in CHROME,  it's adding the "www.simplemachines.org/community" part before the actual url that is being generated....

NOTE... that does NOT happen if you leave the http:// part in the field when you click the button... example:


http://www.testforum.com

It also doesn't strip the http:// part from the visible URL tag...


Offline Trekkie101

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,157
  • Gender: Male
  • Ad Astra!
    • https://www.facebook.com/DLRPRoundup on Facebook
    • @dlrproundup on Twitter
    • DLRP Roundup
Fixed in new editor, my bad!

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
OK... using Chrome 21.0.1180.79 m

I am now going to try to use the URL button with the url www.testforum.com to see the result...


www.testforum.com
Sorry FrizzleFried, I was referring to the editor that will be used in 2.1, not in that one. ;)
I know that one behaves in that way, but it will not be fixed.


It also doesn't strip the http:// part from the visible URL tag...
That's correct.


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.