Getting a file from gitlab returns nil when using %2F

Started by eli310, Jan 18, 2021, 02:45 AM

Previous topic - Next topic

eli310

Could anyone help me with this?

f = http.get("https://gitlab.com/api/v4/projects/22651806/repository/files/system%%2Fcload.lua/raw?ref=master&access_token=acz8QUbxQaFbekX-ARty&path=startupcl.lua")
print(f.readAll())
f.close()

it errors at f is nil

eli310

It works in the browser but why not in Lua?

Lupus590

The link didn't work in my browser, is it posible that your browser is also using it's cookies to make the link work?

eli310

It seems that it gives me a 400 bad request error. Gitlab might just be having issues

Lupus590

Are you sure that you are getting the raw URL right?

It looks like this
https://gitlab.com/hbomb79/Titanium/-/blob/develop/src/loadFirst.cfgshould turn into this
https://gitlab.com/hbomb79/Titanium/-/raw/develop/src/loadFirst.cfg

QuickMuffin8782

I've already included a gitlab tip repository for you that is in the group. Check for where it says "Gitlab Tips".
"The Blue Blur" - Working on Net Star OS, a new frontier for Red Star OS 3.0
linktr.ee/quickmuffin8782

QuickMuffin8782

#6
Quote from: eli310 on Jan 18, 2021, 02:45 AMCould anyone help me with this?

f = http.get("https://gitlab.com/api/v4/projects/22651806/repository/files/system%%2Fcload.lua/raw?ref=master&access_token=acz8QUbxQaFbekX-ARty&path=startupcl.lua")
print(f.readAll())
f.close()

it errors at f is nil
It shows that it got the files, but created the directories, and didn't put any files. Try checking the docs and see if you got it correctly. It only put the files and created them at the root directory but not in the system directories that you made for COSC.
"The Blue Blur" - Working on Net Star OS, a new frontier for Red Star OS 3.0
linktr.ee/quickmuffin8782

eli310

Quote from: Lupus590 on Jan 20, 2021, 12:00 PMAre you sure that you are getting the raw URL right?

It looks like this
https://gitlab.com/hbomb79/Titanium/-/blob/develop/src/loadFirst.cfgshould turn into this
https://gitlab.com/hbomb79/Titanium/-/raw/develop/src/loadFirst.cfg
I was using the raw api not that but ill try it