Skip to content

docs(actions): add note about enctype="multipart/form-data" for file … #11397

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gilesbutler
Copy link

Description (required)
Adds a note to the Astro Actions documentation explaining that forms containing file uploads must include enctype="multipart/form-data" for file inputs to be parsed correctly. This is necessary for validation using z.instanceof(File) to work as expected with schema validation libraries like Zod.

Related issues & labels (optional)
Suggested label: area: docs

@astrobot-houston
Copy link
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/actions.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Copy link

netlify bot commented Apr 8, 2025

Deploy Preview for astro-docs-2 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ae9056b
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/67f59a1c99962100081e0b05
😎 Deploy Preview https://deploy-preview-11397--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@astrobot-houston
Copy link
Contributor

Hello! Thank you for opening your first PR to Astro’s Docs! 🎉

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any broken links you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Netlify 🥳.

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@sarah11918
Copy link
Member

Thanks for the suggestion for docs!

It feels a little rough on the reader to try to shove extra "oh, by the way!" facts at them before they've even seen the basic code snippet, though.

What would you think about, after the existing log out button example, a second example. This way, we don't have to cram stuff into a tight paragraph, but can show an example of submitting a form.

I could see something like (just really rough wording off the top of my head):

Depending on your inputs, additional attributes on the <form> element may be necessary for proper schema validation with Zod. For example, to include file uploads, add enctype="multipart/form-data" to ensure that files are sent in a format correctly recognized by z.instanceof(File) inputs.

// short code snippet here, matching the length/detail of the button one //

What do you think about a format like that?

@sarah11918 sarah11918 added the improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) label Apr 9, 2025
Copy link
Member

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving in terms of correctness!

@gilesbutler
Copy link
Author

I don't mind @sarah11918, feel free to change it whatever you think works :)

I just came across the issue and took a while to figure out why it didn't work so thought it should be in the docs for other 👍

@sarah11918
Copy link
Member

@gilesbutler Would you like to update the text and provide the example? Or would you like someone else to jump in here now? 😄

@gilesbutler
Copy link
Author

Hey @sarah11918 I don't mind at all 😊 You probably have a better idea of what works with your experience on the product but I can take a look next week if not.

@sarah11918
Copy link
Member

It's been a busy launch week, so we haven't had much time to follow up here! If you're still interested, would love for you to continue with this @gilesbutler !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants