Keyword

Attachments STILL broken? Problems with MP3 files being renamed to TXT

More
6 months 3 weeks ago #175264 by James Riley

Fotis wrote: Try commenting out this line: github.com/getk2/k2/blob/master/administrator/components/com_k2/models/item.php#L439
Let me know.


I've commented out Line 439 [ $handle->file_new_name_body = JFile::stripExt($filename); ]
The file is not only still saved as a txt file, but also renamed with a random file name (see attached screen clipping; you can see the original file name maintained in the download link).
Attachments:

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
6 months 2 weeks ago #175265 by Fotis
Revert the change.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

More
4 months 2 weeks ago #176086 by Adam M
I've been using K2 for many years but I'm also now having this same issue since updating to the most recent version. My issue is when I upload mp3s which are turned to .txt files. Was there any further solution at all? I've spoken to my hosting company and they've said everything is fine their end. Many thanks.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
4 months 2 weeks ago #176087 by Fotis
Try this please.

Edit this file github.com/getk2/k2/blob/90cff2f28649fd83a296e9d491ef1f21335dd88b/administrator/components/com_k2/models/item.php#L442-L443 and replace the 2 lines with:
$handle->allowed = array(
    "application/arj",
    "application/download",
    "application/gnutar",
    "application/rar",
    "application/vnd.rar",
    "application/x-bzip",
    "application/x-bzip2",
    "application/x-compressed",
    "application/x-gzip",
    "application/x-rar-compressed",
    "application/x-unknown",
    "application/x-zip-compressed",
    "application/x-zip",
    "application/zip",
    "multipart/x-gzip",
    "multipart/x-zip",
    "audio/*",
    "video/*"
);

Let me know.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

More
4 months 2 weeks ago #176089 by Adam M
Thanks Fotis, I made the change but this resulted in the file not uploading at all. The attachment details were still added to the database but without a file name.

Please Log in or Create an account to join the conversation.

More
4 months 2 weeks ago #176091 by Adam M
Here's the log from the upload class in case it's helpful...

system information
- class version : 0.34dev
- operating system : Linux
- PHP version : 7.3.18
- GD version : 2.1.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 8M (8388608 bytes)
- language : en_GB
source is a local file /tmp/phpDsPdnR
- local file OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
MIME type detected as audio/mpeg; charset=binary by UNIX file() command
- MIME validated as audio/mpeg
source variables
- You can use all these before calling process()
file_src_name : phpDsPdnR
file_src_name_body : phpDsPdnR
file_src_name_ext :
file_src_pathname : /tmp/phpDsPdnR
file_src_mime : audio/mpeg
file_src_size : 1956870 (max= 8388608)
file_src_error : 0
process file to /public_html/media/k2/attachments/
- file size OK
- script renamed as phpDsPdnR.txt!
- file mime OK : text/plain
- new file name body : isnt-she-lovely
- destination variables
file_dst_path : /public_html/media/k2/attachments/
file_dst_name_body : isnt-she-lovely
file_dst_name_ext : txt
- no auto_rename if same filename exists
- destination file details
file_dst_name : karlo-isnt-she-lovely.txt
file_dst_pathname : /public_html/media/k2/attachments/isnt-she-lovely.txt
cleanup
- delete temp file /tmp/phpDsPdnR

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
4 months 2 weeks ago #176092 by Fotis
Resolved.

Try v2.10.4 (dev) from: getk2.org/downloads/?f=K2_Development_Release.zip

Let me know.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
4 months 2 weeks ago #176093 by Fotis
The above dev release resolves issues for many other file types as well and contains newer MIME detection for some.

So anyone who had issues before is advised to test this one out.

Thank you.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

More
4 months 2 weeks ago #176095 by Adam M
Thanks so much for your efforts, this has solved the issue for me.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
4 months 2 weeks ago #176097 by Fotis
Great :)

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum