We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

ABSOLUTE URLs !! .in database - breaking images on upload to server! | Forum

Topic location: Forum home » Support » General Questions
Reinhard Sacher
Reinhard Sacher Dec 13 '16
When uploading my database and my dev-site to my live server, I noticed that Oxwall puts ABSOLUTE urls (including domain-name) in database-records for images..etc.....


..which of course breaks images !!


Did I miss a setting somewhere to only use relative URLs ???


I think this would be a very odd behaviour/bug...

dave Leader
dave Dec 13 '16
Hi, what table are you referring to might i ask. 
Reinhard Sacher
Reinhard Sacher Dec 14 '16
ow_mailbox_user_last_data

ow_newsfeed_action

ow_notifications_notification


sample data from ow_newsfeed_action:


{ "photoIdList": [ "2" ], "string": { "key": "photo+feed_single_description", "vars": { "number": 1, "albumUrl": "http:\/\/ubuntu:8085\/photo\/useralbum\/Cara\/1", "albumName": "test" } }, "actionDto": null, "content": { "format": "image", "vars": { "image": "http:\/\/ubuntu:8085\/ow_userfiles\/plugins\/photo\/photo_preview_2_584862abecaed.jpg", "url": { "routeName": "view_photo", "vars": { "id": "2" } }, "info": { "route": { "textKey": "photo+album", "label": "test", "routeName": "photo_user_album", "vars": { "user": "Cara", "album": "1" } } } } }, "view": { "iconClass": "ow_ic_picture" } }


Which gets me (on /index)


The Forum post is edited by Reinhard Sacher Dec 14 '16
dave Leader
dave Dec 14 '16
ok i found this for you: 


https://developers.oxwall.com/forum/topic/11053


As suggested (not tested)  i guess you could export the table (data only) (MAKE TWO COPIES JUST IN CASE THE NEW ONE GETS MESSED UP) and then open up the sql file in notepad, programmers notepad or other code editor.  Then use replace all to replace the old url with the new url.  


Then clear your table, DONT DROP IT JUST TRUNCATE IT.  Then import the new sql file.  Seems logical. 





The Forum post is edited by dave Dec 14 '16
Reinhard Sacher
Reinhard Sacher Dec 14 '16
Thanks Dave!


This is exactly what I do now.... SQL-Dump - search/replace and upload..


I just wanted to know, if I miss a setting somewhere.... because it seems so odd and unlogical for OW to do this - !!


.... and maybe someone can update the modules --- which is obviously a bug somewhere


Thanks a lot!


Greetings Reinhard

Reinhard Sacher
Reinhard Sacher Dec 14 '16
Just for ... anyone...I just replaced all occurences of an ABSOLUTE Url ("http://server:port") with just an empty string - so Urls are RELATIVE then.


This seems to work fine on first test - no more broken links in images 


you should search (in your SQL-DUMP ... eg. phpmyadmin -> Export) for:

http:\\/\\/SERVERNAME:PORT .... where Servername is your server (if you are using a non-standard port then include a ":" and your port number.)

and replace that whole string with an empty "" 

DO NOT replace the following "\\/" 


So for example: Local Machine-Name "ubuntu" , running on port 8085


In your SQL you will find:

"avatarUrl":"http:\\/\\/ubuntu:8085\\/ow_userfiles\\/plugins\\/base\\/avatars\\/avatar_2_1480110464.jpg"


after the Search/Replace-by-"" you should get

"avatarUrl":"\\/ow_userfiles\\/plugins\\/base\\/avatars\\/avatar_2_1480110464.jpg"

... which is then a RELATIVE Url which gets translated to

http://live-server-name.com/ow_userfiles.... etc...

and not be broken



Strange behaviour - most probably bug

dave Leader
dave Dec 14 '16
Your welcome and glad you got it sorted :)