Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No reliable Way to find Assets made with C# #262

Open
jcommander opened this issue Oct 30, 2022 · 7 comments
Open

No reliable Way to find Assets made with C# #262

jcommander opened this issue Oct 30, 2022 · 7 comments

Comments

@jcommander
Copy link

Typing "C#" into the Search Box just displays all kinds of Assets, maybe the # gets filtered out of the search or its just too short.
Maybe the Project's Github Statistic for used programming language could be pulled and those containing C# could get flagged so a Filter could also be added for it.

This would be useful for C# Users that want to find reference Code/Projects and would like to keep their Projects in C# entirely.

@Calinou
Copy link
Member

Calinou commented Oct 30, 2022

Related to #250.

The asset library rewrite features a tag system, but there's no ETA for deploying it.

@jcommander
Copy link
Author

Great, I hope it's making progress.

But besides this, I've noticed the '#' does get escaped out of the search filter (just like dots, semicolons etc.)
So if you search for "C#" (or even "C################" for that matter), you will still only get results for "C".

Would it be possible to ignore the Character '#' without security impediments or maybe just allow the Search Term "C#" so you can find it when it's put in the Title?

@Calinou
Copy link
Member

Calinou commented Nov 1, 2022

Would it be possible to ignore the Character '#' without security impediments or maybe just allow the Search Term "C#" so you can find it when it's put in the Title?

The code is here:

https://github.com/godotengine/asset-library/blob/342e663d7902bbafcce71998567606ebc5fda662/src/routes/asset.php#L47-L49

It might be possible but it's not trivial. I don't have plans to work on it personally, so feel free to look into it.

@LauraWebdev
Copy link

Since the rewrite project has been discontinued, are there any plans for the AssetLib to enable filtering by language? I'd love to use as many C# tools as I can since it's easier to develop with a somewhat unified codebase.

@Calinou
Copy link
Member

Calinou commented Oct 24, 2023

Since the rewrite project has been discontinued, are there any plans for the AssetLib to enable filtering by language? I'd love to use as many C# tools as I can since it's easier to develop with a somewhat unified codebase.

This is the same issue as adding tags to the asset library. It requires adding a tags system, which implies a database migration and changes to the editor frontend to be able to filter by tag instead of using categories.

Converting old categories to tags is easy, but doing all the work around tagging is nontrivial. Old assets will also be missing tags (other than the legacy category tag) unless their author edits the asset in question.

@jcommander
Copy link
Author

jcommander commented Oct 25, 2023

The code is here:

https://github.com/godotengine/asset-library/blob/342e663d7902bbafcce71998567606ebc5fda662/src/routes/asset.php#L47-L49

It might be possible but it's not trivial. I don't have plans to work on it personally, so feel free to look into it.

Okay, so after looking into it again, the line of code seems to miss it's purpose to me.
Looking at its git blame, #251 mentions it's to trim whitespaces.
Not only does preg_replace('/[[:punct:]]+/', cut way more, testing it doesn't even trim whitespaces properly for me.
Shouldn't trim() be used here?
Running

$testStr = "  C# Script   ";
echo '%'.preg_replace('/[[:punct:]]+/', '%', $testStr).'%';
echo '%'.trim($testStr).'%';

returns

% C% Script %
%C# Script%

PHP Playground

@Calinou
Copy link
Member

Calinou commented Oct 25, 2023

Shouldn't trim() be used here?

Both are used, as the output of trim() is passed to preg_replace(). I don't know why preg_replace() was originally used here though (there is nothing about it in git blame).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants