Skip to content

Commit 257e9bb

Browse files
committed
make it use the right bucket name
1 parent 4540db5 commit 257e9bb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

conditional/blueprints/major_project_submission.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def display_major_project(user_dict=None):
6565
return render_template(
6666
"major_project_submission.html",
6767
major_projects=major_projects,
68+
bucket_name=bucket,
6869
major_projects_len=len(major_projects),
6970
username=user_dict["username"])
7071

@@ -156,12 +157,15 @@ def submit_major_project(user_dict=None):
156157
for file in os.listdir(temp_dir):
157158
filepath = f"{temp_dir}/{file}"
158159

159-
s3.upload_file(filepath, 'major-project-media', f"{project.id}/{file}")
160+
s3.upload_file(filepath, app.config['S3_BUCKET_ID'], f"{project.id}/{file}")
160161

161162
os.remove(filepath)
162163

163164
# Delete the temp directory once all the files have been stored in S3
164165
os.rmdir(temp_dir)
166+
else:
167+
log.error("Could not create temp directory for uploading files")
168+
return jsonify({"success": False}), 500
165169

166170

167171
# Send the slack ping only after we know that the data was properly saved to the DB

conditional/templates/major_project_submission.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ <h5 class="img-header"><strong>Images</strong></h5>
326326
{% for f in p['files'] %}
327327
<img
328328
class="proj-img"
329-
src="https://assets.csh.rit.edu/major-project-media/{{ f }}"
329+
src="https://assets.csh.rit.edu/{{ bucket_name }}/{{ f }}"
330330
alt="User submitted image for the project"/>
331331
{% endfor %}
332332
{% endif %}
@@ -342,4 +342,4 @@ <h5 class="img-header"><strong>Images</strong></h5>
342342
{% endif %}
343343
</div>
344344

345-
{% endblock %}
345+
{% endblock %}

0 commit comments

Comments
 (0)