question

andrem avatar image
andrem asked

Corona SDK - Content Download Thru CDN not working.

Hi Guys,

I think there may be an issue with the content download on Corona SDK.

Whenever I set ThruCDN to false, I can download files, but as soon as I set ThruCDN to true when downlaoding the file I get an error message on the console telling me "Invalid Parameter: URL argument was malformed URL"

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

The results should be the same as if you called GetContentDownloadUrl any other way. Can you try getting the download URL by making the call in Postman, and see if that URL works for you? If not, can you describe specifically how you're making the download call itself, and what the info is for the file (Title ID and Key for the file)?

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

andrem avatar image andrem commented ·
Hi,

I'm not really sure how to make the call in Postman. I am not quite skilled in this field.

This is how my code looks like. How can I do the call in Postman?

-- ACTUAL DOWNLOAD
local function actualDownload( result )
	local params = {}
	print(result.URL)
	network.download(
		result.URL,
		"GET",
		onComplete,
		params,
		pathEditorZip,
		system.DocumentsDirectory
	)
end
		
-- GET DOWNLOAD URL
local downloadRequest = {
	Key = pathCloud,
	HttpMethod = "GET",
	ThruCDN = true
}
PlayFabClientApi.GetContentDownloadUrl(downloadRequest, actualDownload,
	function(error)
		print(" Failed DOWNLOAD URL: " .. error.errorMessage)
	end
)

0 Likes 0 ·
brendan avatar image brendan andrem commented ·

Postman is a tool that lets you make Web API calls quickly and easily, to test out functionality: https://www.getpostman.com/.

We also provide a complete Postman Collection for all PlayFab API calls: https://github.com/PlayFab/PostmanCollection.

From your code, it actually appears that there isn't a problem with the PlayFab API call (which gets the URL for the download), but rather with the network.download call. Here's what I would recommend:

Get the download URL from our service, whether via your code or Postman, with ThruCDN set to true. Use that to try to download the file directly, using cURL (as described here: https://playfab.com/how-use-playfabs-content-management-api/). If that works, you know that the issue is with the network.download call itself, in which case you'll need to reach our to the Corona team. If that doesn't work, please open a ticket and send us all the details of your test - the specifics of the GetContentDownloadUrl call, as well as the cURL command issued.

0 Likes 0 ·
andrem avatar image andrem brendan commented ·

Wow, did not know about a tool like this! I am totally putting my hands on it!

I finally was able to find out what the issue was. All our folders at the File Manager had spaces in it. By just replacing with "_" in the name of our folders I was able to fix it.

Thanks a lot for the support :-)

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.