Set default values for each property of versions object#3268
Conversation
- set Docker versions (local/remote) to `null` if they are empty strings, undefined or null; - set other components versions to `"N/A"` if they are empty strings, undefined or null; - set branches and hashes to `null` if they are empty strings, undefined or null; Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
|
This should be done in the API and the code here should be rewritten to not needing the immediate |
|
It's another possibility. |
|
Do you want to solve the issue in FTL or should I mark this PR as "ready for review"? |
|
I already did this somewhere these days but seemingly forgot to push the branch. Will have a look for it after work. |
|
Is this really needed? Looking into the FTL source code, this exact usecase seems to be already there. Okay, no I guess what is really needed here is a small fix of the This will effectively avoid an empty string being returned by the API and, hence, the automatic substitution with the |
|
Even with pi-hole/FTL#2335 we need some small tweak to avoid the empty component to disappear |
With the new FTL branch, only the EDIT: If Using the new FTL branch, the API is sending: "web":{
"local":{
"branch":null,
"version":null,
"hash":null
},
"remote":{
"version":null,
"hash":"54e5b294"
}
},We can avoid this web PR is FTL sends something like this: "web":{
"local":{
"branch":null,
"version":"N/A",
"hash":null
},
"remote":{
"version":"N/A",
"hash":"54e5b294"
}
}, |
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
|
I am going back and forth about this but I think it's more natural (as in: computer-friendly) for the API to consistently reply with |
What does this PR aim to accomplish?
Fixes issues when
versionsfile contains empty or null versions, to avoid an empty footer or invalid version descriptions.If
local.versionisnull, the old code completely hides the component version.See:
How does this PR accomplish the above?
EDIT:
Now FTL will never send an empty string. If FTL can't find a valid string it will send
null.If
local.versionisnull, the footer code will convert it to "N/A", to avoid empty footer or invalid versions.By submitting this pull request, I confirm the following:
git rebase)