Skip to content

Commit a622ad2

Browse files
landritostephenplusplus
authored andcommitted
Storage: add system test for unicode filenames. (#2515)
1 parent 845cb96 commit a622ad2

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

packages/storage/system-test/storage.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,52 @@ 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+
it('should not perform normalization form C', function() {
564+
var name = 'Caf\u00e9';
565+
var file = bucket.file(name);
566+
567+
var expectedContents = 'Normalization Form C';
568+
569+
return file.get()
570+
.then(function(data) {
571+
var receivedFile = data[0];
572+
assert.strictEqual(receivedFile.name, name);
573+
return receivedFile.download();
574+
})
575+
.then(function(contents) {
576+
assert.strictEqual(contents.toString(), expectedContents);
577+
});
578+
});
579+
580+
// Normalization form D: an ASCII character followed by U+0301 combining
581+
// character; URL should end with Caf%C3%A9
582+
it('should not perform normalization form D', function() {
583+
var name = 'Cafe\u0301';
584+
var file = bucket.file(name);
585+
586+
var expectedContents = 'Normalization Form D';
587+
588+
return file.get()
589+
.then(function(data) {
590+
var receivedFile = data[0];
591+
assert.strictEqual(receivedFile.name, name);
592+
return receivedFile.download();
593+
})
594+
.then(function(contents) {
595+
assert.strictEqual(contents.toString(), expectedContents);
596+
});
597+
});
598+
});
599+
554600
describe('getting buckets', function() {
555601
var bucketsToCreate = [
556602
generateName(),

0 commit comments

Comments
 (0)