Answers.Body: <p>Seems to be working as expected for me.  I've got an Asset Source setup with an S3 bucket.</p>
  
  <p>At the root of the bucket, there is a <code>test1</code> folder and in it is a <code>test2</code> folder... i.e. <code>root/test1/test2/</code>.  From there, I put a <code>test.jpg</code> file inside of <code>test2</code>.</p>
  
  <p>When I do this from a template (where ID is the Asset ID for <code>test.jpg</code>:</p>
  
  <pre><code>{% set image = craft.assets.id(13).first() %}
  
  {{ image.getPath() }}
  </code></pre>
  
  <p>I get the expected:</p>
  
  <pre><code>test1/test2/test.jpg
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-01T00:35:20.690Z
Answers.Text: Thanks Brad. Its interesting, because I'm using a plugin that uses getPath and this doesn't appear to be the case. For reference its this plugin relating to the service file here: https://github.com/sjelfull/Craft-CloudFrontInvalidation/blob/master/cloudfrontinvalidation/services/CloudfrontInvalidationService.php. I did report to the author, but I'm still not sure if I'm missing something.
Answers.UserDisplayName: James White
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-01T00:20:14.940Z
Answers.LastActivityDate: 2018-07-01T00:20:14.940Z
Answers.UserDisplayName: Brad Bell
Body: <p>I'm reading through the Craft docs in relation to the AssetFileModel. </p>
  
  <p>Looking at the <code>getPath()</code> method, this reads in theory that it should return the full path to the asset relative to the root, with any sub directories etc.</p>
  
  <p><a href="https://docs.craftcms.com/api/v2/models/AssetFileModel.html#getPath-detail" rel="nofollow noreferrer">https://docs.craftcms.com/api/v2/models/AssetFileModel.html#getPath-detail</a></p>
  
  <p>Yet this doesn't to appear to be the case, I seem to be getting <code>/filename.ext</code></p>
  
  <p>If however I was to use <code>folderPath()</code> this then provides the subfolder name configured in the relevant S3 asset source.</p>
  
  <p><a href="https://github.com/craftcms/cms/blob/master-v2/src/models/AssetFileModel.php#L384" rel="nofollow noreferrer">https://github.com/craftcms/cms/blob/master-v2/src/models/AssetFileModel.php#L384</a></p>
  
  <p>Is this correct? Is <code>getPath()</code> meant to behave this way with S3 asset sources?</p>
  
Tags: <assets><s3>
Title: getPath() does not return subfolder for S3 asset source
ThreadText: # getPath() does not return subfolder for S3 asset source
  
  (Asked by: username_0 on 2018-06-27)
  
  I'm reading through the Craft docs in relation to the AssetFileModel.
  
  Looking at the `getPath()` method, this reads in theory that it should return the full path to the asset relative to the root, with any sub directories etc.
  
  <https://docs.craftcms.com/api/v2/models/AssetFileModel.html#getPath-detail>
  
  Yet this doesn't to appear to be the case, I seem to be getting `/filename.ext`
  
  If however I was to use `folderPath()` this then provides the subfolder name configured in the relevant S3 asset source.
  
  <https://github.com/craftcms/cms/blob/master-v2/src/models/AssetFileModel.php#L384>
  
  Is this correct? Is `getPath()` meant to behave this way with S3 asset sources?
  
  **Tags:** assets, s3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-07-01. Score: 1
  
  Seems to be working as expected for me. I've got an Asset Source setup with an S3 bucket.
  
  At the root of the bucket, there is a `test1` folder and in it is a `test2` folder... i.e. `root/test1/test2/`. From there, I put a `test.jpg` file inside of `test2`.
  
  When I do this from a template (where ID is the Asset ID for `test.jpg`:
  
  ```
  {% set image = craft.assets.id(13).first() %}
  
  {{ image.getPath() }}
  
  ```
  
  I get the expected:
  
  ```
  test1/test2/test.jpg
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks username_1. Its interesting, because I'm using a plugin that uses getPath and this doesn't appear to be the case. For reference its this plugin relating to the service file here: https://github.com/sjelfull/Craft-CloudFrontInvalidation/blob/master/cloudfrontinvalidation/services/CloudfrontInvalidationService.php. I did report to the author, but I'm still not sure if I'm missing something.  
  
  ---
  
  