Keyword

K2 Attachments return 404 error / File does not exist

  • Mark Schultz
  • Mark Schultz's Avatar Topic Author
  • Offline
  • Junior Member
More
7 years 4 months ago #159861 by Mark Schultz
Using K2 2.71 w/ J3.65.

All attachments return 404 error:

example w/ 9 attachments: nvcacademy.net/index.php?option=com_k2&view=item&id=1179:prepare-for-love-part-01&Itemid=137

attachments are there, I tried setting attachments folder, copying attachments to another folder and pointing to that one and leaving the parameter blank.
a direct link to the 1st attachment on the page above works nvcacademy.net/media/k2/attachments/EB_Calling_a_Pause_0001.pdf

From back end, downloading file returns this error: File does not exist

the failing url looks like this:
nvcacademy.net/administrator/index.php?option=com_k2&view=item&task=download&id=423_9437645427bfa2d864bdb952ded656ac

what is this value: 9437645427bfa2d864bdb952ded656ac and where is it stored? I can't find it anywhere in the db or in a file.

I recently upgraded to 3.65 from 1.5.

Any idea for resolution or further investigation is welcome.

thanks.

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

  • Mark Schultz
  • Mark Schultz's Avatar Topic Author
  • Offline
  • Junior Member
More
7 years 4 months ago - 7 years 4 months ago #159864 by Mark Schultz
I found that if the hash check is removed from item.php in the /administrator/components/com_k2/models folder, it works.

These nice php developer folks found the issue and shared it with the world:
www.itoctopus.com/404-error-when-trying-to-download-a-k2-attachment

Curious if K2 developers, know of this issue and have a plan to address it?

item.php in /administrator/components/com_k2/models
commented out hash check
$attachment = JTable::getInstance('K2Attachment', 'Table');
if ($mainframe->isSite())
{
$token = JRequest::getVar('id');
$check = JString::substr($token, JString::strpos($token, '_') + 1);
$hash = version_compare(JVERSION, '3.0', 'ge') ? JApplication::getHash($id) : JUtility::getHash($id);
/*if ($check != $hash)
{
JError::raiseError(404, JText::_('K2_NOT_FOUND'));
}*/
}
$attachment->load($id);
Last edit: 7 years 4 months ago by Mark Schultz.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 3 months ago #159896 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 Attachments return 404 error / File does not exist
Hello there,

Which version did you patch?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Mark Schultz
  • Mark Schultz's Avatar Topic Author
  • Offline
  • Junior Member
More
7 years 3 months ago #159900 by Mark Schultz
Using K2 2.7.1 w/ J3.65.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 3 months ago #159913 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 Attachments return 404 error / File does not exist
From what I can see the code is correct in the upcoming version, so you are covered when you update K2.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum