Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-lefebvre committed Dec 12, 2024
1 parent b79a6b0 commit aeec14a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
12 changes: 6 additions & 6 deletions packages/astro/src/actions/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ export function vitePluginActions({
code += `\nexport * from 'astro/actions/runtime/virtual/server.js';`;
} else {
code += `\nexport * from 'astro/actions/runtime/virtual/client.js';`;
code = code.replace(
"'/** @TRAILING_SLASH@ **/'",
JSON.stringify(
shouldAppendForwardSlash(settings.config.trailingSlash, settings.config.build.format),
),
);
}
code = code.replace(
"'/** @TRAILING_SLASH@ **/'",
JSON.stringify(
shouldAppendForwardSlash(settings.config.trailingSlash, settings.config.build.format),
),
);
return code;
},
};
Expand Down
3 changes: 2 additions & 1 deletion packages/astro/templates/actions.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {
ActionError,
ACTION_QUERY_PARAMS,
appendForwardSlash,
deserializeActionResult,
getActionQueryString,
appendForwardSlash,
} from 'astro:actions';

const ENCODED_DOT = '%2E';
Expand Down
5 changes: 3 additions & 2 deletions packages/astro/test/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,14 +593,15 @@ it('getActionPath() should return the right path', async () => {
root: './fixtures/actions/',
adapter: testAdapter(),
base: '/base',
trailingSlash: 'always',
});
const devServer = await fixture.startDevServer();
const res = await fixture.fetch('/base/get-action-path');
const res = await fixture.fetch('/base/get-action-path/');

assert.equal(res.ok, true);
const html = await res.text();
let $ = cheerio.load(html);
assert.equal($('[data-path]').text(), '/base/_actions/transformFormInput');
assert.equal($('[data-path]').text(), '/base/_actions/transformFormInput/');
await devServer.stop();
});

Expand Down

0 comments on commit aeec14a

Please sign in to comment.