Keyword

Attachment doesn't work with advanced sef

  • Nicola
  • Nicola's Avatar Topic Author
  • Offline
  • New Member
More
7 years 7 months ago #158090 by Nicola
Replied by Nicola on topic Attachment doesn't work with advanced sef
Hello, it's the first test I've done as you suggested. Deleted every record inside redirect component, disabled redirect plugin, installed latest from github.
Same as before. Today I try with an empty website to understand if it's a problem of this website.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #158092 by Krikor Boghossian
Replied by Krikor Boghossian on topic Attachment doesn't work with advanced sef
Let me know on the results.
Also try with the site both cached and uncached.

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

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

  • Nicola
  • Nicola's Avatar Topic Author
  • Offline
  • New Member
More
7 years 7 months ago #158113 by Nicola
Replied by Nicola on topic Attachment doesn't work with advanced sef
In a new website it works without problems. Now I look what it's different between two websites ;)

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #158117 by Krikor Boghossian
Replied by Krikor Boghossian on topic Attachment doesn't work with advanced sef
Great news Nicola :)
Let me know when you locate the culprit.

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

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

  • Nicola
  • Nicola's Avatar Topic Author
  • Offline
  • New Member
More
7 years 7 months ago - 7 years 7 months ago #158125 by Nicola
Replied by Nicola on topic Attachment doesn't work with advanced sef
Hello, I've found the problem.
At some point it call this query:
SELECT * 
  FROM radgw_k2_attachments 
  WHERE itemID=83
And it works. Then with this query:
SELECT items.id, categories.id AS catid, 
  CASE WHEN CHAR_LENGTH(categories.alias) THEN CONCAT_WS('-', categories.id, categories.alias) ELSE categories.id END AS catslug 
		
  FROM radgw_k2_items AS items 
		
  INNER JOIN radgw_k2_categories AS categories 
  ON items.catid = categories.id 
		
  WHERE items.id = 1
it return 0. Because the ID is wrong. If I manually wrote:
SELECT items.id, categories.id AS catid, 
  CASE WHEN CHAR_LENGTH(categories.alias) THEN CONCAT_WS('-', categories.id, categories.alias) ELSE categories.id END AS catslug 
		
  FROM radgw_k2_items AS items 
		
  INNER JOIN radgw_k2_categories AS categories 
  ON items.catid = categories.id 
		
  WHERE items.id = 83
it works as expected.

EDIT: If I uninstall k2 and Install again, it works. I can't understand where to look

Edit2: Now I'm able to reproduce the error:
1) install version 2.7.0 and play with categories and articles: create a few and delete them. Empty trash, create again a few, and delete them.
2) Upgrade to version 2.7.1, empty trash and create categories with articles. The error is here. In this case the article

For example, the article now have id: 3 (but it's strange because I've created other articles before). BTW, it use this code:
SELECT * 
  FROM radgw_k2_attachments 
  WHERE itemID=3
and then:
SELECT items.id, categories.id AS catid, 
  CASE WHEN CHAR_LENGTH(categories.alias) THEN CONCAT_WS('-', categories.id, categories.alias) ELSE categories.id END AS catslug 
		
  FROM radgw_k2_items AS items 
		
  INNER JOIN radgw_k2_categories AS categories 
  ON items.catid = categories.id 
		
  WHERE items.id = 2

EDIT 3: for some reason it fetch the id of attachment and not the Id of article. Infact, If I change the attachment id to 3 in database, it works as expected.
Last edit: 7 years 7 months ago by Nicola.

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

  • Nicola
  • Nicola's Avatar Topic Author
  • Offline
  • New Member
More
7 years 6 months ago #158199 by Nicola
Replied by Nicola on topic Attachment doesn't work with advanced sef
I'm sorry to bump but Am I the only one with this issue?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 6 months ago #158201 by Krikor Boghossian
Replied by Krikor Boghossian on topic Attachment doesn't work with advanced sef
I take it, this is from the debug console.
can you give me some context?

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

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

  • Nicola
  • Nicola's Avatar Topic Author
  • Offline
  • New Member
More
7 years 6 months ago #158202 by Nicola
Replied by Nicola on topic Attachment doesn't work with advanced sef
Sure, I've found why the url of attachment with advanced sef is wrong. It can't load the category ID because instead use the category ID it use the attachment ID.
This happen after upgrade from 2.7.0 to 2.7.1 and after create and delete some articles and category.
I don't have a perfect "step by step" method to reproduce, but the query explain what I'm talking about: for some reason (and I don't know why) it's looking for attachment ID instead category ID.
So if I've an attachment ID 20 and I don't have category ID 20 the url is missing the /category/ part and it generate 404 error.

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


Powered by Kunena Forum