Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Bad API key silently fails, Causes mod info to be blank #167

Open
AgentDove opened this issue Feb 17, 2024 · 1 comment
Open

[BUG] Bad API key silently fails, Causes mod info to be blank #167

AgentDove opened this issue Feb 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@AgentDove
Copy link

Describe the bug
A bad API key will cause the API call to return a 401 response, and does not catch it.
This returns null to the ArmaMod.UpdateInfos loop and fails for each of it's tries, and has no check for all attempts failing.
ArmaModCollection.AddSteamMod adds the new mod before getting info on it, and doesn't do anything if info getting fails.

To Reproduce

  1. Use a bad or expired API key. (through setup or by editing the config)
  2. Add a new mod or mods through the mods page.
  3. The new mod/mods will have no name or author and a size of 0.00B.

Expected behaviour
A mods info should be filled out.
If that is not possible it should raise an error, with the response type. And depending if it's a 401, prompt to update or remove the API key.

Actual behaviour
The fields of a mods info will be null; Name, Author, SteamLastUpdated, LocalLastUpdated, Size.

Screenshots
image

OS Version:

  • OS: Microsoft Windows Server 2022 Standard
  • FASTER Version: 1.9.4.1 (f449231)

Additional context

Newtonsoft.Json.JsonReaderException
  HResult=0x80131500
  Message=Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
  Source=Newtonsoft.Json
  StackTrace:
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
   at FASTER.Models.SteamWebApi.ApiCall(String uri) in C:\Users\Administrator\source\repos\FASTER\FASTER\Models\SteamWebApi.cs:line 87
   at FASTER.Models.SteamWebApi.GetSingleFileDetails(UInt32 modId) in C:\Users\Administrator\source\repos\FASTER\FASTER\Models\SteamWebApi.cs:line 29

  This exception was originally thrown at this call stack:
    [External Code]
    FASTER.Models.SteamWebApi.ApiCall(string) in SteamWebApi.cs
    FASTER.Models.SteamWebApi.GetSingleFileDetails(uint) in SteamWebApi.cs

// Bad API key
{StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Server: nginx
  Cache-Control: max-age=0, no-cache, no-store
  Pragma: no-cache
  Date: Sat, 17 Feb 2024 19:52:32 GMT
  Connection: keep-alive
  Content-Type: text/html; charset=UTF-8
  Content-Length: 174
  Expires: Sat, 17 Feb 2024 19:52:32 GMT
}}

// No API key
{StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
  Server: nginx
  X-eresult: 1
  Date: Sat, 17 Feb 2024 20:01:19 GMT
  Connection: keep-alive
  Content-Type: application/json; charset=UTF-8
  Expires: Sat, 17 Feb 2024 20:01:19 GMT
  Content-Length: 2287
}}
@jupster jupster added the bug Something isn't working label Feb 17, 2024
@OverlordZorn
Copy link

grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants