Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
3d2116df
Commit
3d2116df
authored
Apr 03, 2015
by
Thomas Müller
Browse files
Merge pull request #15386 from oparoz/yaml-cnf-mediatype
Introducing media types for yml, yaml, cnf, conf
parents
a2087f30
70ec74e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/private/helper.php
View file @
3d2116df
...
...
@@ -2,17 +2,17 @@
/**
* @author Arthur Schiwon <blizzz@owncloud.com>
* @author Bart Visscher <bartv@thisnet.nl>
* @author Bjrn Schiele <schiessle@owncloud.com>
* @author Christopher Schpers <kondou@ts.unde.re>
* @author Bj
ö
rn Schie
ß
le <schiessle@owncloud.com>
* @author Christopher Sch
ä
pers <kondou@ts.unde.re>
* @author Fabian Henze <flyser42@gmx.de>
* @author Felix Moeller <mail@felixmoeller.de>
* @author Franois Kubler <francois@kubler.org>
* @author Fran
ç
ois Kubler <francois@kubler.org>
* @author Frank Karlitschek <frank@owncloud.org>
* @author Georg Ehrke <georg@owncloud.com>
* @author Jakob Sack <mail@jakobsack.de>
* @author Jan-Christoph Borchardt <hey@jancborchardt.net>
* @author Joas Schilling <nickvergessen@owncloud.com>
* @author Jrn Friedrich Dreyer <jfd@butonic.de>
* @author J
ö
rn Friedrich Dreyer <jfd@butonic.de>
* @author Lukas Reschke <lukas@owncloud.com>
* @author Michael Gapczynski <GapczynskiM@gmail.com>
* @author Morris Jobke <hey@morrisjobke.de>
...
...
@@ -22,8 +22,8 @@
* @author Robin Appelman <icewind@owncloud.com>
* @author Robin McCorkell <rmccorkell@karoshi.org.uk>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Simon Knnecke <simonkoennecke@gmail.com>
* @author Thomas Mller <thomas.mueller@tmit.eu>
* @author Simon K
ö
nnecke <simonkoennecke@gmail.com>
* @author Thomas M
ü
ller <thomas.mueller@tmit.eu>
* @author Thomas Tanghus <thomas@tanghus.net>
* @author Valerio Ponte <valerio.ponte@gmail.com>
* @author Vincent Petry <pvince81@owncloud.com>
...
...
@@ -75,6 +75,7 @@ class OC_Helper {
'application/x-perl'
=>
'text/code'
,
'application/x-php'
=>
'text/code'
,
'text/x-shellscript'
=>
'text/code'
,
'application/yaml'
=>
'text/code'
,
'application/xml'
=>
'text/html'
,
'text/css'
=>
'text/code'
,
'application/x-tex'
=>
'text'
,
...
...
lib/private/mimetypes.list.php
View file @
3d2116df
...
...
@@ -53,6 +53,8 @@ return array(
'cbz'
=>
array
(
'application/x-cbr'
,
null
),
'cc'
=>
array
(
'text/x-c'
,
null
),
'cdr'
=>
array
(
'application/coreldraw'
,
null
),
'cnf'
=>
array
(
'text/plain'
,
null
),
'conf'
=>
array
(
'text/plain'
,
null
),
'cpp'
=>
array
(
'text/x-c++src'
,
null
),
'cr2'
=>
array
(
'image/x-dcraw'
,
null
),
'css'
=>
array
(
'text/css'
,
null
),
...
...
@@ -183,5 +185,7 @@ return array(
'xltx'
=>
array
(
'application/vnd.openxmlformats-officedocument.spreadsheetml.template'
,
null
),
'xml'
=>
array
(
'application/xml'
,
'text/plain'
),
'xrf'
=>
array
(
'image/x-dcraw'
,
null
),
'yaml'
=>
array
(
'application/yaml'
,
'text/plain'
),
'yml'
=>
array
(
'application/yaml'
,
'text/plain'
),
'zip'
=>
array
(
'application/zip'
,
null
),
);
lib/repair/repairmimetypes.php
View file @
3d2116df
...
...
@@ -218,6 +218,24 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
self
::
updateMimetypes
(
$updatedMimetypes
);
}
private
function
introduceConfMimeType
()
{
$updatedMimetypes
=
array
(
'conf'
=>
'text/plain'
,
'cnf'
=>
'text/plain'
,
);
self
::
updateMimetypes
(
$updatedMimetypes
);
}
private
function
introduceYamlMimeType
()
{
$updatedMimetypes
=
array
(
'yaml'
=>
'application/yaml'
,
'yml'
=>
'application/yaml'
,
);
self
::
updateMimetypes
(
$updatedMimetypes
);
}
/**
* Fix mime types
*/
...
...
@@ -245,5 +263,13 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
if
(
$this
->
introduce3dImagesMimeType
())
{
$this
->
emit
(
'\OC\Repair'
,
'info'
,
array
(
'Fixed 3D images mime types'
));
}
if
(
$this
->
introduceConfMimeType
())
{
$this
->
emit
(
'\OC\Repair'
,
'info'
,
array
(
'Fixed Conf/cnf mime types'
));
}
if
(
$this
->
introduceYamlMimeType
())
{
$this
->
emit
(
'\OC\Repair'
,
'info'
,
array
(
'Fixed Yaml/Yml mime types'
));
}
}
}
tests/lib/repair/repairmimetypes.php
View file @
3d2116df
...
...
@@ -221,15 +221,52 @@ class RepairMimeTypes extends \Test\TestCase {
$this
->
renameMimeTypes
(
$currentMimeTypes
,
$fixedMimeTypes
);
}
/**
* Test renaming the 3D image media type
*/
public
function
testRename3dImagesMimeType
()
{
$currentMimeTypes
=
[
[
'test.
e
ps'
,
'application/octet-stream'
],
[
'test.
ps
'
,
'application/octet-stream'
],
[
'test.
j
ps'
,
'application/octet-stream'
],
[
'test.
mpo
'
,
'application/octet-stream'
],
];
$fixedMimeTypes
=
[
[
'test.eps'
,
'application/postscript'
],
[
'test.ps'
,
'application/postscript'
],
[
'test.jps'
,
'image/jpeg'
],
[
'test.mpo'
,
'image/jpeg'
],
];
$this
->
renameMimeTypes
(
$currentMimeTypes
,
$fixedMimeTypes
);
}
/**
* Test renaming the conf/cnf media type
*/
public
function
testRenameConfMimeType
()
{
$currentMimeTypes
=
[
[
'test.conf'
,
'application/octet-stream'
],
[
'test.cnf'
,
'application/octet-stream'
],
];
$fixedMimeTypes
=
[
[
'test.conf'
,
'text/plain'
],
[
'test.cnf'
,
'text/plain'
],
];
$this
->
renameMimeTypes
(
$currentMimeTypes
,
$fixedMimeTypes
);
}
/**
* Test renaming the yaml media type
*/
public
function
testRenameYamlMimeType
()
{
$currentMimeTypes
=
[
[
'test.yaml'
,
'application/octet-stream'
],
[
'test.yml'
,
'application/octet-stream'
],
];
$fixedMimeTypes
=
[
[
'test.yaml'
,
'application/yaml'
],
[
'test.yml'
,
'application/yaml'
],
];
$this
->
renameMimeTypes
(
$currentMimeTypes
,
$fixedMimeTypes
);
...
...
@@ -348,6 +385,10 @@ class RepairMimeTypes extends \Test\TestCase {
[
'test.DNG'
,
'image/x-dcraw'
],
[
'test.jps'
,
'image/jpeg'
],
[
'test.MPO'
,
'image/jpeg'
],
[
'test.conf'
,
'text/plain'
],
[
'test.cnf'
,
'text/plain'
],
[
'test.yaml'
,
'application/yaml'
],
[
'test.yml'
,
'application/yaml'
],
];
$fixedMimeTypes
=
[
...
...
@@ -383,6 +424,10 @@ class RepairMimeTypes extends \Test\TestCase {
[
'test.DNG'
,
'image/x-dcraw'
],
[
'test.jps'
,
'image/jpeg'
],
[
'test.MPO'
,
'image/jpeg'
],
[
'test.conf'
,
'text/plain'
],
[
'test.cnf'
,
'text/plain'
],
[
'test.yaml'
,
'application/yaml'
],
[
'test.yml'
,
'application/yaml'
],
];
$this
->
renameMimeTypes
(
$currentMimeTypes
,
$fixedMimeTypes
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment