ComputerCraft Forums

ComputerCraft => Ask a Pro => Topic started by: eli310 on Jan 18, 2021, 02:45 AM

Title: Getting a file from gitlab returns nil when using %2F
Post by: eli310 on Jan 18, 2021, 02:45 AM
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
Title: Getting a file from gitlab returns nil when using %2F
Post by: eli310 on Jan 18, 2021, 02:46 AM
It works in the browser but why not in Lua?
Title: Getting a file from gitlab returns nil when using %2F
Post by: Lupus590 on Jan 18, 2021, 11:23 AM
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?
Title: Getting a file from gitlab returns nil when using %2F
Post by: eli310 on Jan 20, 2021, 10:38 AM
It seems that it gives me a 400 bad request error. Gitlab might just be having issues
Title: Getting a file from gitlab returns nil when using %2F
Post by: Lupus590 on Jan 20, 2021, 12:00 PM
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
Title: Getting a file from gitlab returns nil when using %2F
Post by: QuickMuffin8782 on Jan 20, 2021, 10:53 PM
I've already included a gitlab tip repository for you that is in the group. Check for where it says "Gitlab Tips".
Title: Getting a file from gitlab returns nil when using %2F
Post by: QuickMuffin8782 on Feb 01, 2021, 07:54 PM
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.
Title: Getting a file from gitlab returns nil when using %2F
Post by: eli310 on Feb 06, 2021, 08:08 AM
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