I think this is wanted, or should we manually convert project machine names to generate urls?

i.e. project_git_instructions is using it to make "Version Control" tab link on the projects pages.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tvn’s picture

Issue tags: +Drupal.org 7.1
drumm’s picture

Spaces should not be allowed.

valthebald’s picture

Assigned: Unassigned » valthebald
valthebald’s picture

Issue tags: +Needs tests

I assume this will need a test

valthebald’s picture

Status: Active » Needs review
Issue tags: -Needs tests
FileSize
859 bytes

Here's the patch that solves the issue.
It needs a test, but since most tests are switched off for project.module, I'd rather create a followup issue for that

valthebald’s picture

Title: Do not allow spaces on project's machine name » Validate allowed characters on project's machine name
drumm’s picture

Status: Needs review » Needs work

Project name contains incorrect symbols

The error message should be a complete sentence, with punctuation. And more friendly — what's an incorrect symbol? Should follow the function naming, from http://www.php.net/manual/en/functions.user-defined.php:

A valid function name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*.

valthebald’s picture

Status: Needs work » Needs review
FileSize
1.01 KB
3.84 KB

Validation rule and error message changed per #7.
Error message after applying patch #8:
Error screenshot

drumm’s picture

Status: Needs review » Needs work

Looks like the condition is reversed. Valid names get the error.

valthebald’s picture

Status: Needs work » Needs review
FileSize
1.01 KB

My bad, of course it is

  • Commit 406d232 on 7.x-2.x authored by valthebald, committed by drumm:
    #2172891 Validate allowed characters on project's machine name
    
drumm’s picture

Status: Needs review » Fixed

Looks good. Committed & deploying.

tvn’s picture

wohoo! thanks valthebald!

  • Commit 3786879 on 7.x-2.x by drumm:
    #2172891, #2227791 Revert 406d232
    
drumm’s picture

Status: Fixed » Needs work
drumm’s picture

Project: Project » Drupal.org customizations
Version: 7.x-2.x-dev » 7.x-3.x-dev
Component: Projects » Code

Let's actually move this to drupalorg. Project module should be a bit generic, it could be used for non-PHP project anyway.

This validation should run only for full projects.

valthebald’s picture

Status: Needs work » Needs review
FileSize
1.65 KB

Here's the patch against drupalorg

drumm’s picture

Status: Needs review » Needs work

Sorry I didn't put this detail in earlier, I was in a hurry.

This should go in drupalorg_project_form_node_form_alter(), within

  if (project_node_is_project($form_state['node'])) {

The project node type shouldn't be hard-coded since modules, themes, etc are actually separate node types.

valthebald’s picture

Status: Needs work » Needs review
FileSize
1.58 KB

Changed per #18

  • Commit 48f7984 on 7.x-3.x authored by valthebald, committed by drumm:
    #2172891 Validate allowed characters on project's machine name
    
drumm’s picture

Status: Needs review » Fixed
Issue tags: +needs drupal.org deployment

Looks good. Will deploy today.

drumm’s picture

Issue tags: -needs drupal.org deployment

Now deployed to Drupal.org.

dww’s picture

Glad to see this resolved, and for the validation to be in drupalorg_project, not project.module itself. It was originally discussed in #1561458: Require project node machine names to be valid Drupal module/theme machine names, but since all the Git commits point here I marked that one duplicate (even though it was the older issue).

Thanks everyone!
-Derek

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

  • Commit 48f7984 on 7.x-3.x, 7.x-3.x-dev authored by valthebald, committed by drumm:
    #2172891 Validate allowed characters on project's machine name