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

Code design flaw #3

Closed
samueldcs opened this issue Jan 24, 2019 · 2 comments
Closed

Code design flaw #3

samueldcs opened this issue Jan 24, 2019 · 2 comments

Comments

@samueldcs
Copy link
Contributor

if(isset($_GET['bucket']) && !is_null($_GET['bucket'])) //Switch from array_key_exists to isset

You are not supposed to access the request body directly from the class, instead, pass the value from the API endpoint (index.php).

Example (index.php):

if(isset($_GET['bucket'] && !is_null[$_GET['bucket'])) {
    $uploader = new RLME\Uploader($_GET['bucket']);
}

And if the bucket is not set (isset() == false), set a default value on the constructor.

Example (Uploader.php)

function __construct($bucket = 'owoapi') {}

If you want, I can create a PR solving this issue

@gtsatsis
Copy link
Owner

We're currently not working on the uploader, and that's just bootstrap code.

If you want to make a PR, you could, but if not, it'll be fixed when we start work on the uploader

@samueldcs
Copy link
Contributor Author

Just keep that in mind and fix it when you can.

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

No branches or pull requests

2 participants