Page MenuHomePhabricator

Impossible to move dwg files
Open, LowPublic

Description

Uploading is dwg files is fine.

$wgFileExtensions = array( 'dwg', 'jpg', 'png', 'gif', 'jpeg', 'pdf', 'txt' );

But moving is impossible.

File:Test 1.dwg >> File:Test 2.dwg = "The new file extension does not match its
type".

Tried adding variations of following to mime.info & mime.types with no luck:

image/vnd.dwg image/x-dwg application/acad [DRAWING]

Image table for all .dwg files has the following field values:
img_media_type = UNKNOWN
img_major_mime = unknown
img_minor_mime = unknown

Not sure this is even considered a bug.


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=23422

Details

Reference
bz25523

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:19 PM
bzimport set Reference to bz25523.
bzimport added a subscriber: Unknown Object (MLST).

removing keyword need-review, since this doesn't need review (there's no patch or anything else to review). Not sure if easy is appropriate either, but leaving that be as I'm not sure what the criteria for "easy" actually is.

Not sure this is even considered a bug.

I'd imagine this is a bug, as if you were able to get past the mime type checks at upload, you should also be able to when moving the file.

arlenbee wrote:

I also have this problem with MP3 files in 1.16.0.

arlenbee wrote:

My config is:

$wgCheckFileExtensions = true;
$wgStrictFileExtensions = true;
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'wav', 'mp3', 'pdf' );

And I am moving from "File:Daily Inspirations 1010-12-9.mp3" to "File:Daily Inspirations 1010-12-9.mp3". I do have Admin access.

Added mp3 move-bug reference link.

Perhaps there is a similar subtle/random fix for subject .dwg files?

Here's a workaround...
Added this line to mime.info:
application/acad application/x-acad application/autocad_dwg image/x-dwg application/dwg application/x-dwg application/x-autocad image/vnd.dwg drawing/dwg [DRAWING]

And added this line to mime.types:
application/acad dwg

This seems to assign a valid mime type to dwg files on upload and allows them to be moved thereafter.

Still, why it doesn't allow moving while being an unknown type is beyond me. I'd rather have just left it alone. Will have to manually fix my image table to compensate for old files I suppose.

Bryan.TongMinh wrote:

I could add a new config option to enable moving of unknown files, or I could just do that unconditionally. Does anybody have anything against the latter option?

Bryan.TongMinh wrote:

Thinking about it, this should follow the same configuration options as regular uploading, so $wgCheckFileExtensions and $wgStrictFileExtensions.

I had tried different combinations of settings of $wgCheckFileExtensions and $wgStrictFileExtensions (before finally re-doing the mime info). Still had the same problem (moving unknown file types). Not sure if anyone else could verify that.

Bryan, I like the idea you mentioned on r66069 better: make the mime checks check for non-canonical types as well as canonical types.

Bryan.TongMinh wrote:

(In reply to comment #11)

Bryan, I like the idea you mentioned on r66069 better: make the mime checks
check for non-canonical types as well as canonical types.

I'm not sure if that would fix the dwg issue, as there is no entry for dwg in mime.info

r82418 -- added mime.info information

I am not sure if I should open an new bug report. I wanted to move an .eml file but get "The new file extension does not match its type" as an error message. (MW 1.16.2)

I'm curious if this is still a problem?

Hmm ..., just tryied to check at least for eml-files. However even though I set $wgVerifyMimeType = false; and added "eml" to the array of $wgFileExtensions it is not possible to upload eml-files on MW 1.23-rc.1. Will have to check this tomorrow. Either I misunderstood something which is possible or it is a bug. I will report another nasty bug reappearing which is there for over a year now. To cut it short: It's obviously already to late today.

I'm curious if this is still a problem?

I just tested moving a .eml file on MW 1.23.6, PHP 5.4 and it is still a problem. The message basically tells me as an admin: You do not have the permission to move the file. The new file extensions does not match the old one. I suppose that this is also the case for .dwg files too.