Skip to content

Commit 5ca22dd

Browse files
committed
Storage: add system test for unicode filenames.
1 parent 845cb96 commit 5ca22dd

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

packages/storage/system-test/storage.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,50 @@ describe('storage', function() {
551551
});
552552
});
553553

554+
describe('unicode validation', function() {
555+
var bucket;
556+
557+
before(function() {
558+
bucket = storage.bucket('storage-library-test-bucket');
559+
});
560+
561+
// Normalization form C: a single character for e-acute;
562+
// URL should end with Cafe%CC%81
563+
describe('normalization form C', function() {
564+
it('should not perform normalization', function(done) {
565+
var name = 'Caf\u00e9';
566+
var expectedContents = 'Normalization Form C';
567+
var file = bucket.file(name);
568+
569+
file.get().then(function(data) {
570+
var receivedFile = data[0];
571+
assert.equal(receivedFile.name, name);
572+
return receivedFile.download();
573+
}).then(function(contents) {
574+
assert.equal(contents.toString(), expectedContents);
575+
}).then(done);
576+
});
577+
});
578+
579+
// Normalization Form D: an ASCII character followed by U+0301 combining
580+
// character; URL should end with Caf%C3%A9
581+
describe('normalization Form D', function() {
582+
it('should not perform normalization', function(done) {
583+
var name = 'Cafe\u0301';
584+
var expectedContents = 'Normalization Form D';
585+
var file = bucket.file(name);
586+
587+
file.get().then(function(data) {
588+
var receivedFile = data[0];
589+
assert.equal(receivedFile.name, name);
590+
return receivedFile.download();
591+
}).then(function(contents) {
592+
assert.equal(contents.toString(), expectedContents);
593+
}).then(done);
594+
});
595+
});
596+
});
597+
554598
describe('getting buckets', function() {
555599
var bucketsToCreate = [
556600
generateName(),

0 commit comments

Comments
 (0)