-
Notifications
You must be signed in to change notification settings - Fork 197
Fix: Preserve null value for "Never" expiration option #2605
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
base: main
Are you sure you want to change the base?
Conversation
Console (appwrite/console)Project ID: Tip Realtime gives you live updates for users, storage, functions, and databases |
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
- Fixed reactive block in expirationInput.svelte to check for null before converting to ISO date - When "Never" is selected, value now remains null instead of being converted to '1970-01-01' - This allows the API to correctly handle null expiration dates for API keys and file tokens Co-authored-by: stnguyen90 <[email protected]>
stnguyen90
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot the file token will generate now, but the API key still won't.
- Updated initialization logic to handle both null and invalid date values (including empty strings) - Removed the check for expirationSelect !== null to allow proper initialization when "Never" is selected - Added isValidDate check before ISO date conversion to prevent converting invalid dates to 'n/a' - This fixes the issue where API keys couldn't be created with "Never" expiration when the parent component initializes expire as an empty string Co-authored-by: stnguyen90 <[email protected]>
Fixed in commit c772abc. The issue was that API key creation initializes Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
stnguyen90
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot instead of changing
|
@copilot Run the formatter because there is a lint error. |
Added a "Required Pre-Completion Checklist" section that instructs agents to: - Always run format, check, lint, test, and build before finishing - Fix any failures before marking work complete - Never skip these mandatory quality gates This addresses the requirement to ensure all code changes are properly validated. Co-authored-by: stnguyen90 <[email protected]>
Done in commit a17bb09. Ran Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
| value = toLocaleDateISO(new Date(value).getTime()); | ||
| // Only convert to ISO date if value is not null and is a valid date | ||
| if (value !== null && isValidDate(value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ItzNotABug do we want to have invalid dates be converted to null automatically? Otherwise, I was thinking we update the API key to make sure to pass null for the default value:
console/src/routes/(console)/project-[region]-[project]/overview/(components)/create.svelte
Line 28 in 2f91d97
| expire = ''; |
Ideally, expire should really be a date object so we avoid all these issues, but that's kind of a big change.

Fix: Invalid
expireparam when creating API Key or File TokenThis PR fixes the bug where selecting "Never" as the expiration for API Keys or File Tokens results in an invalid
expireparameter being sent to the API.Root Cause
The issue had two parts:
Original bug: The reactive block in
ExpirationInputunconditionally converted all values to ISO date strings:When "Never" was selected (
value = null), this converted it to'1970-01-01'(epoch date).Additional issue discovered: When the parent component initialized
expireas an empty string''(as in API key creation), the initialization logic didn't properly handle it:value === null && expirationSelect !== nullwas too restrictiveexpirationSelectwasnull(the "Never" option)'n/a'Solution
Made two key changes to the reactive block:
Improved initialization logic:
nulland invalid values (including empty strings)expirationSelect !== nullcheck to allow proper initialization when "Never" is selectedAdded validation before conversion:
nullvalues for "Never" expirationImpact
Fixes expiration handling across all components using
ExpirationInput:Additional Changes
Verification
Fixes #2604
Original prompt
expireparam when creating API Key or File Token #2604✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.