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

fixes issue:1216 #1225

Merged
merged 1 commit into from Feb 28, 2023
Merged

fixes issue:1216 #1225

merged 1 commit into from Feb 28, 2023

Conversation

santhosh-reddy03
Copy link
Contributor

Please review the changes related to this issue, I have only updated the changes related to url functionality in AzureStorage.
I have tested by importing the module into my django application, haven't used test cases as they were not using connection_string.

Please let me know if they are any improvements/changes required.

@santhosh-reddy03
Copy link
Contributor Author

I have updated the isort changes and pushed again.

@jschneier jschneier linked an issue Feb 27, 2023 that may be closed by this pull request
@jschneier
Copy link
Owner

Thanks for the PR. This would definitely fix the issue (a test is missing though).

More generally: is there a use case for setting AZURE_ACCOUNT_NAME & AZURE_ACCOUNT_KEY if you are already setting AZURE_CONNECTION_STRING? If not, then probably it makes sense to parse these variables out in the constructor rather than in the url() method.

Maybe @alibeyram can weigh in?

@jschneier
Copy link
Owner

@santhosh-reddy03 can you move this logic to the end of __init__ please. I think that is a bit better.

@santhosh-reddy03
Copy link
Contributor Author

When I was reproducing the issue, it was showing account_key was missing, but since we are able to set both account_name and account_key from connection_string, I m updating both.

@jschneier I have now updated the changes inside __init__ function, Please check.

@jschneier
Copy link
Owner

@santhosh-reddy03 the indentation is wrong causing the lint tests to fail. Can you please fix.

@santhosh-reddy03
Copy link
Contributor Author

I have updated, can you please check now

@jschneier
Copy link
Owner

@santhosh-reddy03 failed again due to trailing whitespace.

@jschneier
Copy link
Owner

Merged, thanks.

@santhosh-reddy03
Copy link
Contributor Author

Thank you

@jschneier
Copy link
Owner

@santhosh-reddy03 where did the regex you used come from btw? the one in the issue is different. did you try generating connection strings with various characters?

@santhosh-reddy03
Copy link
Contributor Author

No, for storage account_name, its alpha numerical's and for account_key they have not provided any specifications so I was considering all the characters till the next separation ;. Will deep dive and see if there are any specifications or format for account_keys.

@santhosh-reddy03
Copy link
Contributor Author

santhosh-reddy03 commented Mar 1, 2023

We can also use find method, if there are any issues with regex
string[string.find('AccountName'): string.find(';', string.find('AccountName'))].replace("AccountName=", '')

github-merge-queue bot pushed a commit to mozilla/experimenter that referenced this pull request Sep 11, 2023
#9385)

Bumps [django-storages](https://github.com/jschneier/django-storages)
from 1.13.1 to 1.14.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/jschneier/django-storages/blob/master/CHANGELOG.rst">django-storages's
changelog</a>.</em></p>
<blockquote>
<p>1.14 (2023-09-04)</p>
<hr />
<h2>General</h2>
<ul>
<li><strong>Breaking</strong>: Drop support for Django 4.0
(<code>[#1235](https://github.com/jschneier/django-storages/issues/1235)</code>_)</li>
<li><strong>Breaking</strong>: The long deprecated &amp; removed (from
Django) <code>(modified|created|accessed)_time</code> methods have been
removed from the various storages, please replace with the
<code>get_(modified|created|accessed)_time</code> methods</li>
<li>Add support for saving <code>pathlib.PurePath</code> names
(<code>[#1278](https://github.com/jschneier/django-storages/issues/1278)</code>_)</li>
<li>Add support for Django 4.2
(<code>[#1236](https://github.com/jschneier/django-storages/issues/1236)</code>_)</li>
</ul>
<h2>Azure</h2>
<ul>
<li>Set <code>account_(name|key)</code> from
<code>connection_string</code> if not provided
(<code>[#1225](https://github.com/jschneier/django-storages/issues/1225)</code>_)</li>
</ul>
<h2>Dropbox</h2>
<ul>
<li><strong>Deprecated:</strong> The name
<code>DropboxStorage.location</code> has been deprecated, please rename
to <code>DropboxStorage.root_path</code>, a future version will
remove support for the old name.
(<code>[#1251](https://github.com/jschneier/django-storages/issues/1251)</code>_)</li>
<li>Storage and related names with a captialized B have been changed to
no longer have one e.g <code>DropboxStorage</code> has now replaced
<code>DropBoxStorage</code>. Aliases have been added so no change is
necessary at this time. A future version might deprecate the old names.
(<code>[#1250](https://github.com/jschneier/django-storages/issues/1250)</code>_)</li>
<li><code>DropboxStorage</code> now conforms to the
<code>BaseStorage</code> interface
(<code>[#1251](https://github.com/jschneier/django-storages/issues/1251)</code>_)</li>
<li>Fix name mangling when saving with certain complex root paths
(<code>[#1279](https://github.com/jschneier/django-storages/issues/1279)</code>_)</li>
</ul>
<h2>FTP</h2>
<ul>
<li>Use setting <code>BASE_URL</code> if it is defined
(<code>[#1238](https://github.com/jschneier/django-storages/issues/1238)</code>_)</li>
</ul>
<h2>Google Cloud</h2>
<ul>
<li><strong>Breaking</strong>: Support for the deprecated
<code>GS_CACHE_CONTROL</code> has been removed. Please set the
<code>cache_control</code> parameter of
<code>GS_OBJECT_PARAMETERS</code> instead.
(<code>[#1220](https://github.com/jschneier/django-storages/issues/1220)</code>_)</li>
</ul>
<h2>Libcloud</h2>
<ul>
<li>Reading a file that does not exist will now raise
<code>FileNotFoundError</code>
(<code>[#1191](https://github.com/jschneier/django-storages/issues/1191)</code>_)</li>
</ul>
<h2>SFTP</h2>
<ul>
<li>Add closing context manager for standalone usage to ensure
connections are cleaned up
(<code>[#1253](https://github.com/jschneier/django-storages/issues/1253)</code>_)</li>
</ul>
<h2>S3</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/jschneier/django-storages/commit/d1cd2db41fd3bec01fe97d4b095159f974b91673"><code>d1cd2db</code></a>
Release version 1.14 (<a
href="https://redirect.github.com/jschneier/django-storages/issues/1291">#1291</a>)</li>
<li><a
href="https://github.com/jschneier/django-storages/commit/557226a9147545ea17a0f9edfbe5a974c09e1dde"><code>557226a</code></a>
ignore s3 namespace change in git blame (<a
href="https://redirect.github.com/jschneier/django-storages/issues/1290">#1290</a>)</li>
<li><a
href="https://github.com/jschneier/django-storages/commit/e1c3b38cc2e6c5bc8330db046386a0541dd1d39e"><code>e1c3b38</code></a>
[s3] change s3 backend namespace to s3 and add compat shim (<a
href="https://redirect.github.com/jschneier/django-storages/issues/1289">#1289</a>)</li>
<li><a
href="https://github.com/jschneier/django-storages/commit/c3a567d0aa13d248b9bef652cee8ff3d678f5522"><code>c3a567d</code></a>
point to docs for all configuration (<a
href="https://redirect.github.com/jschneier/django-storages/issues/1288">#1288</a>)</li>
<li><a
href="https://github.com/jschneier/django-storages/commit/abce92af42f8d66544146daf8d0a5124f5b576e5"><code>abce92a</code></a>
[general] remove dead Storage API methods (<a
href="https://redirect.github.com/jschneier/django-storages/issues/1287">#1287</a>)</li>
<li><a
href="https://github.com/jschneier/django-storages/commit/b02f7e26de45bdbd93f0ce6cd32beb64d4922a06"><code>b02f7e2</code></a>
[s3] fix retrieving SSE-C files (<a
href="https://redirect.github.com/jschneier/django-storages/issues/1286">#1286</a>)</li>
<li><a
href="https://github.com/jschneier/django-storages/commit/ad36a9ffd57b94afb051f7bb4715dc706af92b96"><code>ad36a9f</code></a>
[docs] document OPTIONS settings (<a
href="https://redirect.github.com/jschneier/django-storages/issues/1285">#1285</a>)</li>
<li><a
href="https://github.com/jschneier/django-storages/commit/19a15c2054ffc90994578fd2a99918ab81218864"><code>19a15c2</code></a>
[s3] fix saving files with string content (<a
href="https://redirect.github.com/jschneier/django-storages/issues/911">#911</a>)</li>
<li><a
href="https://github.com/jschneier/django-storages/commit/89ca5bc8e31095f4c9e8bdf851557e41c6364122"><code>89ca5bc</code></a>
[s3] add s3 extras_require (<a
href="https://redirect.github.com/jschneier/django-storages/issues/1284">#1284</a>)</li>
<li><a
href="https://github.com/jschneier/django-storages/commit/53d66750dd89e12afd826ca5483c936fe615cfd8"><code>53d6675</code></a>
[s3] S3Boto3StorageFile respects mode on readlines (<a
href="https://redirect.github.com/jschneier/django-storages/issues/1000">#1000</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/jschneier/django-storages/compare/1.13.1...1.14">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=django-storages&package-manager=pip&previous-version=1.13.1&new-version=1.14)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

AZURE_BLOB_CONNECT_STR does not work for url
2 participants