Support SVG (#3883)

* Update add-file.ts

* Update package.json

* Revert "Update add-file.ts"

This reverts commit ba0fe83b54a44493447208dfb3cc304a60df6fdd.

* Update add-file.ts

* Update package.json

* Update add-file.ts

* Update add-file.ts

* Create image.svg

* Update api.ts
This commit is contained in:
Acid Chicken (硫酸鶏) 2019-01-13 18:21:10 +09:00 committed by syuilo
parent 00d5fdfc13
commit 018837db0b
4 changed files with 21 additions and 1 deletions

View file

@ -808,6 +808,20 @@ describe('API', () => {
expect(res).have.status(400);
}));
it('SVGファイルを作成できる', async(async () => {
const izumi = await signup({ username: 'izumi' });
const res = await assert.request(server)
.post('/drive/files/create')
.field('i', izumi.token)
.attach('file', fs.readFileSync(__dirname + '/resources/image.svg'), 'image.svg');
expect(res).have.status(200);
expect(res.body).be.a('object');
expect(res.body).have.property('name').eql('image.svg');
expect(res.body).have.property('type').eql('image/svg+xml');
}));
});
describe('drive/files/update', () => {

1
test/resources/image.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path fill="#FF40A4" d="M128 80c-16 4-20 24-20 48v16c0 8-8 16-20.3 8 4.3 20 24.3 28 40.3 24s20-24 20-48v-16c0-8 8-16 20.3-8C164 84 144 76 128 80"/><path fill="#FFBF40" d="M192 80c-16 4-20 24-20 48v16c0 8-8 16-20.3 8 4.3 20 24.3 28 40.3 24s20-24 20-48v-16c0-8 8-16 20.3-8C228 84 208 76 192 80"/><path fill="#408EFF" d="M64 80c-16 4-20 24-20 48v16c0 8-8 16-20.3 8C28 172 48 180 64 176s20-24 20-48v-16c0-8 8-16 20.3-8C100 84 80 76 64 80"/></svg>

After

Width:  |  Height:  |  Size: 505 B