Getty Images Download module provides an UI to search Getty image by keyword and allows user to sort by date. The matching images are listed in grid with available image dimension & size and text information so user can select image and download from Getty Server and make available under the Drupal Media browser library. User can download once and use downloaded media image across the website.

https://www.drupal.org/project/gettyimages
The Getty Images module is similar, but it doesn't have the download feature I added to my module.

Project link

https://www.drupal.org/project/getty_images_download

Git instructions

git clone --branch 1.0.x https://git.drupalcode.org/project/getty_images_download.git

PAreview checklist

http://pareview.net/r/71

Comments

maheshpa created an issue. See original summary.

maheshpa’s picture

Title: Getty images Download » [D8] Getty images Download
Issue summary: View changes
maheshpa’s picture

Issue summary: View changes
avpaderno’s picture

Issue summary: View changes
Priority: Major » Normal
Status: Active » Needs work

Thank you for applying!

2.0.0 is a wrong name for a branch, while 1.0.x is a correct branch name. The 2.0.0 branch needs to be deleted and the correct branch needs to be created.

As side note, why did you create a new branch, when there is already the 1.0.x branch?

avpaderno’s picture

Please check the Git settings and verify that git config --get user.email returns an email that is associated with your Drupal.org account. Your commits aren't associated with your account, which usually happens when Git is using an email Drupal.org doesn't know.

maheshpa’s picture

Issue summary: View changes
maheshpa’s picture

@kiamlaluno,

Thank You for taking a time to review code!
I have removed the branch 2.0.0 and reconfigure the git with correct email ID associated with drupal.org account and pushed the latest changes in 10.0.x. Please review and let me need anymore changes.

maheshpa’s picture

Priority: Normal » Major
Status: Needs work » Needs review
avpaderno’s picture

Issue summary: View changes
avpaderno’s picture

Priority: Major » Normal
  • What follows is a quick review of the project; it doesn't mean to be complete
  • For every point, the review doesn't make a complete list of lines that should be fixed, but an example of what is wrong in the code
  • A review is about code that doesn't follow the coding standards, contains possible security issue, or doesn't correctly use the Drupal API; if a point isn't about that, it makes it clear
getty_images_download.search_form:
  path: '/admin/gettyimages/search'
  defaults:
    _title: 'Search & Download Getty Images'
    _form: '\Drupal\getty_images_download\Form\GettyImageForm'
  requirements:
    _role: 'authenticated'  

getty_images_download.ajax_search_form:
  path: '/admin/gettyimages/ajax-search'
  defaults:
    _title: 'Search & Download Getty Images'
    _controller: '\Drupal\getty_images_download\Controller\GettyimagesController::openGettyImageSearchForm'
  requirements:
    _role: 'authenticated'

getty_images_download.settings_form:
  path: '/admin/config/system/gettyimageserver'
  defaults:
    _title: 'Getty Images Server API Access Configuration'
    _form: 'Drupal\getty_images_download\Form\SettingsForm'
  requirements:
    _permission: 'administrator'

While it's possible to set the role that is allowed to see a route, it's preferable not to use it and instead set the permission required to access the route. In this way, the route could be made visible to any user the site administrator wants. If the route is associated to the authenticated role, it's not possible to make it visible to anonymous users; if the route is associated to the administrator role, the administrator users cannot access it. (I guess _permission: 'administrator' is supposed to be _role: 'administrator'.)

I still have to review all the code. I am not changing status for that reason.

maheshpa’s picture

@kiamlaluno

Thank Your comments!!

I have fixed the _permission to _role in routing file and also added the local task and menu link to add/edit API configuration form. Please take latest code from same 1.0.x branch.

maheshpa’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
klausi’s picture

Status: Needs review » Needs work
Issue tags: -PAreview: review bonus

Thanks for your contribution!

manual review:

  1. config schema is missing for your configuration, see https://www.drupal.org/docs/8/api/configuration-api/configuration-schema...
  2. GettyImageForm: you catch "Exception" but you need to use "\Exception" for the global name space.
  3. GettyImageForm::searchApi(): You are disabling SSL validation with "verify => FALSE". Is this necessary? This is bad since it breaks expectations how HTTPS works and is a minor security issue. It should be removed, I assume the service has a valid SSL certificate.
  4. GettyImageForm::searchApi(): I think it is not a good idea to directly dump the downloaded images into the root of the public files folder. Can you use your own folder to separate that better from other files?
  5. GettyImageForm::searchApi():: "$fileExist = $this->entityTypeManager->getStorage('file')->loadByProperties(['uri' => $uri]);" this line is used twice without any file being created between, so you will get the same result?
  6. SettingsForm::validateForm(): Please set the "#required" property for form input fields that are required, then you don't need to validate that yourself manually.

I'm also removing the review bonus tag, there are no reviews of other modules listed in the issue summary.

klausi’s picture

Issue tags: +PAreview: security

Adding security tag for the minor security issue.

avpaderno’s picture

Priority: Normal » Minor
avpaderno’s picture

Status: Needs work » Closed (won't fix)

I am closing this application since there have been replies in the past 5 months.