Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pods/generate/SubdomainIdentifierGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class SubdomainIdentifierGenerator implements IdentifierGenerator {

public generate(name: string): ResourceIdentifier {
// Using the punycode converter is a risk as it doesn't convert slashes for example
const cleanName = sanitizeUrlPart(name);
const cleanName = sanitizeUrlPart(name).toLowerCase();
return { path: `${this.baseParts.scheme}${cleanName}.${this.baseParts.rest}` };
}

Expand Down
2 changes: 1 addition & 1 deletion src/pods/generate/SuffixIdentifierGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class SuffixIdentifierGenerator implements IdentifierGenerator {
}

public generate(name: string): ResourceIdentifier {
const cleanName = sanitizeUrlPart(name);
const cleanName = sanitizeUrlPart(name).toLowerCase();
return { path: ensureTrailingSlash(new URL(cleanName, this.base).href) };
}

Expand Down
4 changes: 2 additions & 2 deletions templates/identity/account/create-pod.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<p class="error" id="error"></p>

<fieldset>
<p>Choose a name for your pod</p>
<p>Choose a name for your pod. It will be converted to lower case.</p>
<ol>
<li>
<label for="name">Name</label>
<input id="name" type="text" name="name" autofocus>
</li>
</ol>
<p>Choose which WebID will have initial write permissions on the pod</p>
<p>Choose which WebID will have initial write permissions on the pod.</p>
<ol>
<li class="radio">
<label>
Expand Down
4 changes: 4 additions & 0 deletions test/unit/pods/generate/SubdomainIdentifierGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ describe('A SubdomainIdentifierGenerator', (): void => {
expect(generator.generate('s脿l/u銒')).toEqual({ path: 'http://s-l-u-g.example.com/' });
});

it('converts the name to lowercase.', async(): Promise<void> => {
expect(generator.generate('S脿l/u銒')).toEqual({ path: 'http://s-l-u-g.example.com/' });
});

it('can extract the pod from an identifier.', async(): Promise<void> => {
const identifier = { path: 'http://foo.example.com/bar/baz' };
expect(generator.extractPod(identifier)).toEqual({ path: 'http://foo.example.com/' });
Expand Down
4 changes: 4 additions & 0 deletions test/unit/pods/generate/SuffixIdentifierGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ describe('A SuffixIdentifierGenerator', (): void => {
expect(generator.generate('s脿l/u銒')).toEqual({ path: `${base}s-l-u-g/` });
});

it('converts the name to lowercase.', async(): Promise<void> => {
expect(generator.generate('S脿l/u銒')).toEqual({ path: `${base}s-l-u-g/` });
});

it('can extract the pod from an identifier.', async(): Promise<void> => {
const identifier = { path: 'http://example.com/foo/bar/baz' };
expect(generator.extractPod(identifier)).toEqual({ path: 'http://example.com/foo/' });
Expand Down